Beruflich Dokumente
Kultur Dokumente
DISTRIBUTED COMPUTER
SYSTEMS
PROCESS SYNCHRONIZATION
Dr. Jack Lange
Computer Science Department
University of Pittsburgh
Fall 2015
Process Synchronization
n Mutual Exclusion Algorithms
n Permission Based
n Centralized
n DeCentralized
n Distributed
n Token Based
n Token Ring
n Election Algorithms
n Bully Algorithm
n Ring Algorithm
n Election in Wireless Networks
n Election in Large Scale Systems
1!
11/10/15!
Process Synchronization
n Concurrency and Collaboration are fundamental to
process synchronization in distributed systems
n Processes may required coordination to carry out a global,
collective task in a consistent manner
n Processes may seek to access simultaneously the same
resource
n Access to a shared resource must – Critical Section
n Exclusive access to the resource is required
n Algorithms are required to coordinate execution
among processes
n Grant Mutual Exclusive Access by processes
n Leader Election, etc
MUTUAL EXCLUSION
2!
11/10/15!
Mutual Exclusion
Permission-Based Token-Based
Decentralized Distributed
3!
11/10/15!
CENTRALIZED ALGORITHM
to resources
n Other processes issue requests to access resource
Request(R)
1. Request Resource
2. Wait for Response
3. Receive Grant P C
4. Access Resource
Grant(R)
5. Release Resource
Release(R)
4!
11/10/15!
Q {∅}!
t(R
) C Request(R) P3
Q {P2}! es
equ
Q {P2}! {P3}! R
)
Q {P3}! n t(R
a
Gr )
(R
P1 a se P2
le
Re
Centralized Algorithm
n Advantages
n Easy to understand, verify and implement
n Access Fairness – FIFO order of service is simple to
implement
n Note FIFO policy does not guarantee “Fair Share” access
n Limitations
n Not scalable to large scale distributed systems – Coordinator
is likely to become a bottleneck
n A process requesting a resource cannot distinguish between
being in a “blocked state”, waiting for the resource to be
released, from waiting for a failed coordinator
n Timeout mechanisms or alive messages may be required – to be
designed carefully to avoid early and late timeouts or unnecessary
alive messages
5!
11/10/15!
DECENTRALIZED ALGORITHM
6!
11/10/15!
7!
11/10/15!
DISTRIBUTED ALGORITHM
A Distributed ME Algorithm
8!
11/10/15!
9!
11/10/15!
RA Algorithm – Example
8!
P0 P0 P0
8! 12! OK! OK!
8! OK!
P1 12! P2
P1 OK! P2
P1 P2
12! 12!
n P0 and P2 request n P0 has the lowest n Upon completion of
access to the same timestamp, 8
its CS, P0 sends OK
resource, nearly at the n P0 wins access to message to P2
same time
n Both send requests
the resource
n
CS
P2 can enter its own
with timestamps, 8
and 12, respectively
10!
11/10/15!
P0 P2 P4 P6
P0 P4
P1 P3 P5 P7
P7 P5
P6
n An unordered group of n A logical ring constructed
processes on a network.
in software
§ Token circulates at high speed
on the network
§ A process must have a token to enter its CS
11!
11/10/15!
Lost Token,
Token ring 1 to ∞ 0 to n – 1
Process Crash
n Centralized is the most efficient.
n Token ring efficient when a large of processes seek to use
Assumes that messages are transmitted sequentially over the network
[1]
critical region.
K is the number of attempts, before success
[2]
ELECTION
BACKGROUND
12!
11/10/15!
Election Algorithms
13!
11/10/15!
ELECTION ALGORITHMS
BULLY ALGORITHM
14!
11/10/15!
15!
11/10/15!
16!
11/10/15!
ELECTION ALGORITHMS
RING ALGORITHM
17!
11/10/15!
18!
11/10/15!
ELECTION
19!
11/10/15!
Conclusion
n Mutual Exclusion Algorithms
n Permission Based
n Centralized
n DeCentralized
n Distributed
n Token Based
n Token Ring
n Election Algorithms
n Bully Algorithm
n Ring Algorithm
n Election in Large Scale Systems
20!