CS8603:Distributed Systems Department of CSE
2020 – 2021 2.
9
Jeppiaar Institute of Technology
a receive and ack(M′) is returned.Thus, a cyclic wait is prevented.
2. Also, while waiting for this permission, if a request(M′) from a lower priority process
arrives, a permission(M′) is returned and the process blocks until M′ actually arrives.
Algorithm 6.1 A simplified implementation of synchronous order.
Code shown is for process Pi , 1 ≤ i ≤ n.
(message types)
M, ack(M), request(M), permission(M)
(1) Pi wants to execute SEND(M) to a lower priority process Pj:
• Pi executes send(M) and blocks until it receives ack(M) from Pj. The send event
SEND(M) now completes.
• Any M′ message (from a higher priority processes) and request(M′) request for
synchronization (from a lower priority processes) received during the blocking
period are queued.
(2) Pi wants to execute SEND(M) to a higher priority process Pj:
(2a) Pi seeks permission from Pj by executing send(request(M)).
(2b) While Pi is waiting for permission, it remains unblocked.
(i) If a message M′ arrives from a higher priority process Pk, Pi accepts M′
by scheduling a RECEIVE(M′) event and then executes send(ack(M′)) to Pk.
(ii) If a request(M′) arrives from a lower priority process Pk, Pi executes
send(permission(M′)) to Pk and blocks waiting for the message M′. When M′
arrives, the RECEIVE(M′) event is executed.
(2c) When the permission(M) arrives, Pi knows partner Pj is synchronized and Pi
executes send(M). The SEND(M) now completes.
(3) request(M) arrival at Pi from a lower priority process Pj:
At the time a request(M) is processed by Pi, process Pi executes
send(permission(M)) to Pj and blocks waiting for the message M. When M arrives, the
RECEIVE(M) event is executed and the process unblocks.
Chia sẻ với bạn bè của bạn: |