Thursday, December 13, 2012

Are you ready? ... Are you ready? ... Are you ...

A control system that performs a small number of tasks can be written without concurrent tasks or a full dispatcher, by polling the events from a loop.  There are rules that the polling loop must follow:

If an external operation is started that must be waited for before continuing the task's processing, the task must be exited and re-entered after the minimum time needed to complete the operation has passed, rather than "busy waiting" (looping until the operation is complete).

If the task has completed an operation, and the other tasks will not interfere with what the task has done so far, the task must be exited and re-entered after all other pending tasks have had a chance to run.

If a task must be completed within a specified amount of time, the polling loop cannot take longer than the maximum time allowed for the task less the maximum duration of the rest of the polling loop.  This is sometimes insured by running a timer during the polling loop and skipping further polling when the timer expires.

0 Comments:

Post a Comment

Please enter your comment here. Comments wil be reviewed before being published.

Subscribe to Post Comments [Atom]

<< Home