Mailboxes
Thread Scheduling
4-69
Figure 4-15.
Trace Results from Example 4-15
Associated with the mailbox at creation time is a total number of available
message slots, determined by the mailbox length you specify when you
create the mailbox. In order to synchronize tasks writing to the mailbox, a
counting semaphore is created and its count is set to the length of the
mailbox. When a task does an MBX_post operation, this count is
decremented. Another semaphore is created to synchronize the use of
reader tasks with the mailbox; this counting semaphore is initially set to zero
so that reader tasks block on empty mailboxes. When messages are posted
to the mailbox, this semaphore is incremented.
In Example 4-15, all the tasks have the same priority. The writer tasks try to
post all their messages, but a full mailbox causes each writer to block
indefinitely. The readers then read the messages until they block on an empty
mailbox. The cycle is repeated until the writers have exhausted their supply
of messages.
At this point, the readers pend for a period of time according to the following
formula, and then time out:
TIMEOUT*1ms/(clock ticks per millisecond)
After this timeout occurs, the pending reader task continues executing and
then concludes.
Содержание TMS320 Series
Страница 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Страница 16: ...xvi ...
Страница 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Страница 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Страница 202: ...5 20 ...
Страница 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Страница 288: ...Index 10 Index ...