-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Doing jobs in parallel is the problem attacked in this project. The approach is provide each job with sufficient intelligence on when to start and signal when it is complete. Using this simple approach, each job is implemented in a separate thread which simply waits until its start conditions are met, starts and signals the finish. One of the paradigms used is to be as 'un-coordinated' as possible. In this manner the code is simplified in that the processing and code is within each job itself.
Let a,b,c,d,e be five jobs to be exected. Define the Starting conditions for each job (synonym to predecessor, pre-condition etc) as completion of other jobs. In this case the following example is chosen:
a => {c,d,e} - i.e. Job a can be started if c,d,e are complete.
b => {c,d,e}
c => {d,e}
d =>{}
e =>{}
The obvious solution to parallel execution here is: {d,e} => {c} => {a,b}. The jobs in each set are executed in parallel.
-
Each job is defined as : a. Starting Conditions (The set of messages that this job looks for before starting - such as other jobs completing)
- There must be at least one starting condition. The default is 'start'. b. Job execution c. Post messages at during job execution.
- There must be at least one message posted. The default is 'complete'.
-
Jobs start execution in their own thread space once their starting conditions are satisfied.
-
There exists a message center, where jobs look for messages at some interval
##Implementation
The implementation is: There are three basic modules:
- Initiator: This module creates the job threads, and passes to each its starting conditions.
- Job Class: This is an abstract class, that contains the following methods: a. Ready, - a boolean indicating that the job can be started. b. TestIfReady - calls Ready in a 'wait' loop until ready is true. It then calls 'execute' and on completion posts a message in the message center. c. postMessage - posts message to the message center
doJobs: Concurrent job execution