Hardware Reference
In-Depth Information
Unfortunately, a mailbox provides only a partial solution to the problem of asyn-
chronous communication, since it has a bounded capacity. Unless sender and receiver
have particular arrival patterns, it is not possible to guarantee that the mailbox queue
is never empty or never full. If the queue is full, the sender must be delayed until some
message is received. If the queue is empty, the receiver must wait until some message
is inserted.
For example, consider two periodic tasks, τ 1 and τ 2 , with periods T 1 and T 2 , that
exchange messages through a mailbox having a capacity of n . Let τ 1 be the sender
and τ 2 the receiver. If T 1 <T 2 , the sender inserts in the mailbox more messages than
the receiver can extract; thus, after a certain interval of time the queue becomes full
and the sender must be delayed. From this time on, the sender has to wait for the
receiver, so it synchronizes with its period ( T 2 ). Vice versa, if T 1 >T 2 , the receiver
reads faster than the sender can write; thus, after a while the queue becomes empty and
the receiver must wait. From this time on, the receiver synchronizes with the period
of the sender ( T 1 ). In conclusion, if T 1
= T 2 , sooner or later both tasks will run at the
lowest rate, and the task with the shortest period will miss its deadline.
An alternative approach to asynchronous communication is provided by cyclic asyn-
chronous buffers, which are described in the next section.
10.6.1
CYCLIC ASYNCHRONOUS BUFFERS
Cyclic Asynchronous Buffers, or CABs, represent a particular mechanism purposely
designed for the cooperation among periodic activities, such as control loops and sen-
sory acquisition tasks. This approach was first proposed by Clark [Cla89] for imple-
menting a robotic application based on hierarchical servo-loops, and it is used in the
HARTIK system [But93, BDN93] as a basic communication support among periodic
hard tasks.
A CAB provides a one-to-many communication channel, which at any instant contains
the latest message or data inserted in it. A message is not consumed (that is, extracted)
by a receiving process but is maintained into the CAB structure until a new message
is overwritten. As a consequence, once the first message has been put in a CAB, a
task can never be blocked during a receive operation. Similarly, since a new message
overwrites the old one, a sender can never be blocked.
Note that using such a semantics, a message can be read more than once if the receiver
is faster than the sender, while messages can be lost if the sender is faster than the
receiver. However, this is not a problem in many control applications, where tasks
Search WWH ::




Custom Search