[11 p] Critical section.
We assume that also myNum is 550 for p1, 7700 for p2 and 33 for p3. Process p2 gets first into critical section, because it has already token. The granted of node where p2 is located contains (550, 7700, 33) Process p1 sends following messages: send(request, 2, 1, 551) send(request, 3, 1, 551) and waits in receive(token, granted) Process p3 sends following messages: send(request, 1, 3, 34) send(request, 2, 3, 34) and waits in receive(token, granted) Receive in the same node where p1 send(request, 2, 3, 34) goes to receive(request, source=3 , reqNum=34) After the message has arrived requested=(0, 7700, 34) Receive in the same node where p3 send(request, 3, 1, 551) goes to receive(request, source=1 , reqNum=551) After the message has arrived requested=(551, 7700, 0) Receive in the same node where p2 send(request, 2, 1, 551) goes to receive(request, source=1, reqNum=551) send(request, 2, 3, 34) goes to receive(request, source=3 , reqNum=34) The order of these message is not fixed! After both messages have arrived requested=(551, 0, 34) If the process p2 is in the critical section when messages arrive then the token is sent after p2 has exited the critical section. In the algorithm it is not fixed to which process the token is sent next (it there is more choices). If only one of the messages asking token has only arrived then the message is ofcourse sent to that process. We assume that the token is sent to p1. (P3 would be also possible.) Either the Main process or Receive process will send the token by message: send(token, 1, granted=(550, 7700, 33)) Waiting of process P1 ends and it gets token and granted=(550, 7700, 33). P1 goes to the critical section and after that it sends token to P3 (we assume that P2 has not asked for the token). granted[1]=551 send (token, 3, (551, 7700, 33)) Waiting of process P3 ends and it gets token and granted=(551, 7700, 33). P3 goes to the critical section granted[3]=34 When p3 end the critical section granted=(551, 7700, 34) and it keeps the token if there is no new requests. The order of the processes get into the critical section is p2,p1,p3 or p2,p3,p1.