Lamport’s algorithm for mutual exclusion

16,414 views

Published on

The slide deals with the basic working principle of Lamport's algorithm.It explains the details with example

1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
16,414
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
342
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Lamport’s algorithm for mutual exclusion

  1. 1. LAMPORT’S ALGORITHM BY Neelamani Samal
  2. 2. What is Lamport’s Algorithm <ul><li>It is a computer algorithm </li></ul><ul><li>Intended to improve the safety in the usage of shared resources </li></ul><ul><li>  Using mutual exclusion. </li></ul>
  3. 3. Related Terms <ul><li>Mutual exclusion </li></ul><ul><li>Types of mutual exclusion algorithm </li></ul><ul><li>Critical Section(C.S.) </li></ul><ul><li>Logical Clock </li></ul><ul><li>Causal Ordering Of Messages </li></ul>
  4. 4. Algorithm <ul><li>Every site Si keeps a request_queuei, </li></ul><ul><li>contains mutual exclusion requests ordered by their timestamps </li></ul><ul><li>messages to be delivered in the FIFO order between every pair of sites </li></ul>
  5. 5. System Models <ul><li>Requesting The C.S. </li></ul><ul><li>Executing The C.S. </li></ul><ul><li>Releasing The C.S. ` </li></ul>
  6. 6. Example <ul><li>We have S1,S2,S3 as sites </li></ul><ul><li>S1,S2 request for CS </li></ul><ul><li>S2 Being first </li></ul>
  7. 7. <ul><li>(2,1) </li></ul>S1 S2 S3 (1,2) S1,S2 making requesr for entering CS
  8. 8. <ul><li>(1,2),(2,1) </li></ul>S1 S2 S3 (1,2) (2,1) Site S2 enters CS (1,2) (1,2),(2,1) (1,2),(2,1) S2 enters CS
  9. 9. 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
  10. 10. <ul><li>(2,1) </li></ul>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)
  11. 11. Performance Analysis <ul><li>Total No. of REQUEST (N-1) </li></ul><ul><li>Total No. Of REPLY (N-1) </li></ul><ul><li>Total No. Of RELEASE (N-1) </li></ul><ul><li>Total = 3(N-1) </li></ul>
  12. 12. 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.

×