Hardware Reference
In-Depth Information
SHARED RESOURCE ACCESS PROTOCOLS
As for scheduling, SHARK also achieves modularity in the implementation of shared
resource access protocols. Resource modules are used to make resource protocols
modular and almost independent from the scheduling policy and from the others re-
source protocols. Each resource module exports a common interface, similar to the
one provided by POSIX for mutexes, and implements a specific resource access pro-
tocol. A task may also require a specified protocol through a resource model.
To make the protocol independent of a particular scheduling algorithm, SHARK sup-
ports a generic priority inheritance mechanism independent of the scheduling modules.
Such a mechanism is based on the concept of shadow tasks . A shadow task is a task
that is scheduled in place of another task chosen by the scheduler. When a task is
blocked by the protocol, it is kept in the ready queue, and a shadow task is associated
to it; when the blocked task becomes the first task in the ready queue, its associated
shadow task is scheduled instead. In this way, the shadow task “inherits” the priority
of the blocked task.
To implement this solution, a new field shadow is added to the generic part of the task
descriptor. This field points to the shadow task. Initially, the shadow field is equal to
the task ID (no substitution). When the task blocks, the shadow field is set to the task
ID of the blocking task, or to the task that must inherit the blocked task priority. In
general, a graph can grow from a blocking task (see Figure 12.4). In this way, when the
blocked task is scheduled, the blocking (shadow) task is scheduled, thus allowing the
schedulers to abstract from the resource protocols. This approach has also the benefit
of allowing a classical deadlock detection strategy, by simply searching for cycles in
the shadow graph.
blocked task
blocked task
shadow
shadow
blocked task
blocked task
shadow
shadow
Figure 12.4
The shadow task mechanism.
Search WWH ::




Custom Search