next up previous
Next: Communication across a Network Up: Xinu Low-Level Message Passing Previous: Semantics

Implementation



The Receive State


A process waiting for a message is put in the receive state. The arrival of a message moves it to the ready state.



Send


It checks to see if the specified recipient process has a message outstanding or not. If there is an outstanding message, the send does nothing and returns (why?). Otherwise, it buffers the message and sets a field to indicate that now there is an outstanding message. Finally, if the receiving process is waiting for a message, it moves the process to the ready list (and calls resched), enabling the receiving process to access the message and continue execution.

A message is buffered in a field in the process table entry of the receiving process. (Could it be stored in the process table entry of the sending process?)



Receive


It checks to see if there is a message waiting. If not, it moves the process to the receive state (does the process need to be moved to any list?), and calls reschedule.

It then picks up the message, changes a process table entry field indicating there are no outstanding messages, and returns the message.



Recvclr


It checks if a message has arrived. If no, it returns OK. If yes, it picks the message, changes appropriate fields, and returns the message.


next up previous
Next: Communication across a Network Up: Xinu Low-Level Message Passing Previous: Semantics
Prasun Dewan 2006-02-02