Posts Tagged critical section

The Priority Ceiling Protocol

Each shared resource has a priority ceiling that is defined as the priority of the highest-priority task that can ever access that shared resource. The protocol is defined as follows,

  • A task runs at its original (sometimes called its base) priority when it is outside a critical section.
  • A task can lock a shared resource only if its priority is strictly higher than the priority ceilings of all shared resources currently
    locked by other tasks. Otherwise, the task must block, and the task which has locked the shared resource with the highest priority ceiling inherits the priority of task.

An interesting consequence of the above protocol is that a task may block trying to lock a shared resource, even though the resource is not locked.  The priority ceiling protocol has the interesting and very useful property that no task can be blocked for longer than the duration of the longest critical section of any lower-priority task.

Priority Ceiling Protocol Emulation

The priority ceiling of a shared resource is defined, as before, to be the priority of the highest-priority task that can ever access that resource. A task executes at a priority equal to (or higher than) the priority ceiling of a shared resource as soon as it enters a critical section associated with that resource.  Applying the Priority Ceiling Protocol Emulation to the Priority Ceiling Protocol example results in the following sequence:

cde

Advertisements

, , ,

Leave a comment

%d bloggers like this: