Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
research:software:pom [2007/09/25 18:42] – gpothier | research:software:pom [2007/10/22 14:46] (current) – etanter | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== POM ====== | ||
+ | ===== Introduction ===== | ||
+ | POM (Parallel Object Monitors) is a concurrency abstraction for the coordination of parallel activities over single objects and groups of objects in shared memory systems. It allows a clean separation of the coordination concern from the base application code. | ||
+ | |||
+ | A POM is a monitor defining a // | ||
+ | |||
+ | When a thread invokes a method on an object controlled by a POM, the thread is blocked and the invocation is reified and turned into a //request// object. Requests are then queued in a //pending queue// until the scheduling method grants them permission to execute. The scheduling method can trigger the execution of several requests; all selected requests are free to execute //in parallel//, and are run by the thread that originated the call. When a thread has finished the execution of a request, it has to run the leaving method before leaving the POM. Note that although requests can be executed in parallel, the scheduling and leaving methods are always executed in mutual exclusion. | ||
+ | |||
+ | ===== Usage ===== | ||
+ | |||
+ | POM is based on [[Reflex]] and therefore Reflex should be installed and configured prior to using POM. POM can be used through [[#Direct configuration|direct configuration]] or through [[Annotations|annotations]]. In both cases, the [[Scheduler definition|scheduler]] is defined in the same way. | ||
+ | |||
+ | |||
+ | ==== Direct configuration ==== | ||
+ | |||
+ | Direct configuration consists in explicitly using the POM API in a POM configuration class so as to create the appropriate Reflex links, hooksets and metaobjects. An example of such a configuration can be found in the SVN repository: [[http:// | ||
+ | |||
+ | The first step is to create a configuration class that extends '' | ||
+ | |||
+ | <code java> | ||
+ | public class Config extends POMConfig { | ||
+ | protected void initPOM() { | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | <code java> | ||
+ | schedule(" | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Finally create a '' | ||
+ | |||
+ | <code java> | ||
+ | public static void main(String[] args) throws Throwable | ||
+ | { | ||
+ | LogLevel.set(LogLevel.VERBOSE); | ||
+ | Run.main(new String[] { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Annotations ==== | ||
+ | |||
+ | Another, and often easier, way to configure POM is to use annotations. In this case, the '' | ||
+ | |||
+ | <code java> | ||
+ | @POMSyncClass( | ||
+ | scheduler = Scheduler.class, | ||
+ | group = Scheduler.class, | ||
+ | syncAll = false) | ||
+ | public class MyClass | ||
+ | { | ||
+ | @POMSync(category=" | ||
+ | @POMSync public void bar() { ... } | ||
+ | public void bar2() { ... } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | In the above example, the '' | ||
+ | |||
+ | ==== Scheduler definition ==== | ||
+ | |||
+ | The scheduler is responsible for granting requests the permission to execute. A POM scheduler must extend the '' | ||
+ | |||
+ | Example 1: a simple mutual exclusion scheduler. | ||
+ | |||
+ | <code java> | ||
+ | public class MutualExclusionSched extends POMScheduler { | ||
+ | private boolean working = false; | ||
+ | |||
+ | public void schedule() { | ||
+ | if(!working) working = executeOldest(); | ||
+ | } | ||
+ | |||
+ | public void leave(Request req) { | ||
+ | working = false; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The state of '' | ||
+ | |||
+ | Many more examples are provided in {{bib> | ||
+ | |||
+ | ===== POM and SOM ===== | ||
+ | |||
+ | Sequential Object Monitors, or [[SOM]], | ||
+ | |||
+ | ===== Download ===== | ||
+ | |||
+ | The source code for POM is available in the SVN repository: [[http:// | ||
+ | |||
+ | |||
+ | ===== Publications ===== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | <div id=" | ||
+ | </ |