next up previous
Next: Summary of IPC Up: No Title Previous: Readers and Writers -

Implementation : Synchronous message Passing

  figure96
Figure 8: PCB structure for message passing

PROCEDURE send(dest, msga)
 IF dest waiting for message from source
 THEN copy mesga into dest.mesgb {receive buffer}
    {i.e. copy message content from sender to 
          receiver}
      schedule dest {state := ready & put in ready queue}
 ELSE current.state = waiting {for receiver}
      insert current at end of dest sender queue
 END
END

PROCEDURE receive(source, msgb)
 IF source in current.senderQ
 THEN remove PCB from senderQ
      copy source.msga to msgb 
      {i.e. copy message contents from sender to receiver
       address space}
      schedule source {state := ready & put in readyQ}
 ELSE current.state := waiting {for sender}
END ;

What happens in asynchronous message passing ? How would that be implemented ?



Omer F Rana
Tue Feb 11 19:19:52 GMT 1997