30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

128 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

Rendezvous operation is explained here using the example in Figure 4.5. In this figure Task A and Task<br />

B are running asynchronously.<br />

• If Task A first calls tk cal por, Task A goes to WAIT state until Task B calls tk acp por. The<br />

state of Task A at this time is WAIT on rendezvous call (a).<br />

• If, on the other hand, Task B first calls tk acp por, Task B goes to WAIT state until Task A calls<br />

tk cal por. The stat of Task B at this time is WAIT on rendezvous acceptance (b).<br />

• A rendezvous is established when both Task A has called tk cal por and Task B has called<br />

tk acp por. At this time Task A remains in WAIT state while the WAIT state of Task B is<br />

released. The state of Task A is WAIT for rendezvous completion.<br />

• The Task A WAIT state is released when Task B calls tk rpl rdv. Thereafter both tasks enter a<br />

run state.<br />

TASK A<br />

TASK B<br />

TASK A<br />

TASK B<br />

tk cal por<br />

wait on call<br />

✲ tk acp por<br />

wait on completion<br />

✛ tk rpl rdv<br />

tk acp por<br />

wait on acceptance<br />

tk cal por ✲<br />

wait on completion<br />

✛ tk rpl rdv<br />

(a) tk cal por called first<br />

(b) tk acp por called first<br />

Figure 4.5: Rendezvous Operation<br />

As an example of a specific method for assigning rendezvous object numbers, the ID number of the task<br />

calling the rendezvous can go in the low bits of the rendezvous number, with the high bits used for a<br />

sequential number.<br />

[Rationale for the <strong>Specification</strong>]<br />

While it is true that the rendezvous functionality can be achieved through a combination of other<br />

synchronization and communication functions, better efficiency and ease of programming are achieved<br />

by having a dedicated function for cases where the communication involves an acknowledgment. One<br />

advantage of the rendezvous function is that since both tasks wait until message passing is completed,<br />

no memory space needs to be allocated for storing messages.<br />

The reason for assigning unique rendezvous numbers even when the same task does the calling is as<br />

follows. It is possible that a task, after establishing a rendezvous and going to WAIT state for its<br />

completion, will have its WAIT state released due to timeout or forcible release by another task, then<br />

again call a rendezvous and have that rendezvous established. If the same number were assigned to both<br />

the first and second rendezvous, attempting to terminate the first rendezvous would end up terminating<br />

the second rendezvous. If separate numbers are assigned to the two rendezvous and the task in WAIT<br />

state for rendezvous completion is made to remember the number of the rendezvous for which it is<br />

waiting, error will be returned when the attempt is made to terminate the first rendezvous.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!