Hardware Reference
In-Depth Information
/*-----------------------------------------------------------*/
/* signal -- signals an event */
/*-----------------------------------------------------------*/
void signal (sem s)
proc p;
<disable cpu interrupts>
if (!empty(vsem[s].qsem)) {
p = getfirst(&vsem[s].qsem);
vdes[p].state = READY;
insert(p, &ready);
save context();
schedule();
load context();
else vsem[s].count++;
<enable cpu interrupts>
}
It is worth observing that classical semaphores are prone to the priority inversion phe-
nomenon, which introduces unbounded delays during tasks' execution and prevents
any form of guarantee on hard tasks (this problem is discussed in Chapter 7). As a
consequence, this type of semaphores should be used only by non-real-time tasks, for
which no guarantee is performed. Real-time tasks, instead, should rely on more pre-
dictable mechanisms, based on time-bounded resource access protocols (such as Stack
Resource Policy) or on asynchronous communication buffers. In DICK, the communi-
cation among hard tasks occurs through an asynchronous buffering mechanism, which
is described in Section 10.6.
10.5.6
STATUS INQUIRY
DICK also provides some primitives for inquiring the kernel about internal variables
and task parameters. For example, the following primitives can be used to get the
system time, the state, the deadline, and the period of a desired task.
Search WWH ::




Custom Search