Blocking tasks

The simple scheduler implemented so far provides only two states for the tasks, TASK_READY and TASK_RUNNING. A third state can be implemented to define a task that does not actually need to be resumed, because it is blocked waiting for an event or a timeout. A task can be waiting for a system event of some type, such as:

  • Interrupt events from an input/output device in use by the task
  • Communication from another task, such as the TCP/IP stack
  • Synchronization mechanisms, such as a mutex or a semaphore, to access a shared resource in the system that is currently unavailable
  • Timeout events

To manage the different states, the scheduler may implement two or more lists, to separate the tasks currently running, or ready to run, from ...

Get Embedded Systems Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.