154
Enforcing mutual exclusion with message passing
ncreate  a mailbox mutex shared by n processes
nsend() is non blocking
nreceive() blocks when mutex is empty nInitialization: send(mutex, “go”); nThe first Pi who executes receive() will enter CS. Others will be blocked until Pi resends msg.
Process Pi:
var msg: message;
repeat
  receive(mutex,msg);
  CS
  send(mutex,msg);
  RS
forever