lamport’s algorithm for mutual exclusion
DESCRIPTION
The slide deals with the basic working principle of Lamport's algorithm.It explains the details with exampleTRANSCRIPT
LAMPORT’S ALGORITHM
BY
Neelamani Samal
What is Lamport’s Algorithm
• It is a computer algorithm
• Intended to improve the safety in the
usage of shared resources
• Using mutual exclusion.
Related Terms
• Mutual exclusion
• Types of mutual exclusion algorithm
• Critical Section(C.S.)
• Logical Clock
• Causal Ordering Of Messages
Algorithm
• Every site Si keeps a request_queuei,
• contains mutual exclusion requests ordered by their timestamps
• messages to be delivered in the FIFO order between every pair of sites
System Models
• Requesting The C.S.
• Executing The C.S.
• Releasing The C.S.`
Example
• We have S1,S2,S3 as sites
• S1,S2 request for CS
• S2 Being first
S1
S2
S3
(1,2)
(2,1)
S1,S2 making requesr for entering CS
S1
S2
S3
(1,2)
(2,1)
Site S2 enters CS
(1,2) (1,2),(2,1)
(1,2),(2,1)
(1,2),(2,1)
S2 enters CS
S1
S2
S3
(1,2)
(2,1)
Site S2 exitsCS and release message
(1,2) (1,2),(2,1)
(1,2),(2,1)
(1,2),(2,1)
S2 exits CS
S1
S2
S3
(1,2)
(2,1)
Site S1 entersCS
(1,2) (1,2),(2,1)
(1,2),(2,1)
(1,2),(2,1)
S1enters CS
(2,1)
(2,1)
Performance Analysis
• Total No. of REQUEST (N-1)
• Total No. Of REPLY (N-1)
• Total No. Of RELEASE (N-1)
• Total = 3(N-1)
Conclusion
Though it does not explain the Modern scenario of distributed
systems but , it gave the basic of developing the present way
of handling distributed resources.