Coordinating Dependent Tasks

Often, tasks depend on each other to get work done. For instance, one task might have to stop running until a second task provides additional information or service. When that event occurs, and the first task resumes, the two tasks have synchronized.

Events are important reference points for coordinating or synchronizing tasks. Tasks plan their actions around events by using Event Control Blocks (ECBs). An ECB is a word of storage that represents some event.

The two task management macros that use ECBs are:
  • WAIT - Suspends the task until some event occurs
  • POST - Notifies the task that some event has completed.
For example, when a task has to wait for an ECB, it is suspended until a POST macro is issued for that same ECB. A task can wait for a whole list of ECBs. When any one of them gets posted, the task resumes. See Figure 1.
Figure 1. How Tasks Can Use WAIT and POST Macros
How Tasks Can Use WAIT and POST Macros
WAIT and POST work only among tasks in the same virtual machine. For more information on these macros, see WAIT and POST.