Question

In: Computer Science

Discuss how the Lamport’s algorithm achieves clock synchronization, using 4 clocks of different machines. Here, also...

Discuss how the Lamport’s algorithm achieves clock synchronization, using 4 clocks of
different machines. Here, also compute the time taken for synchronizing the clocks
(consider the clock with lowest time and compute the time with respect to this clock). Can
this algorithm be used in a real time system.

Solutions

Expert Solution

Lamport’s Distributed Mutual Exclusion Algorithm is a permission based algorithm proposed by Lamport as an illustration of his synchronization scheme for distributed systems.
In permission based timestamp is used to order critical section requests and to resolve any conflict between requests.

In Lamport’s Algorithm critical section requests are executed in the increasing order of timestamps i.e a request with smaller timestamp will be given permission to execute critical section first than a request with larger timestamp.

In this algorithm:

  • Three type of messages ( REQUEST, REPLY and RELEASE) are used and communication channels are assumed to follow FIFO order.
  • A site send a REQUEST message to all other site to get their permission to enter critical section.
  • A site send a REPLY message to requesting site to give its permission to enter the critical section.
  • A site send a RELEASE message to all other site upon exiting the critical section.
  • Every site Si, keeps a queue to store critical section requests ordered by their timestamps.
    request_queuei denotes the queue of site Si
  • A timestamp is given to each critical section request using Lamport’s logical clock.
  • Timestamp is used to determine priority of critical section requests. Smaller timestamp gets high priority over larger timestamp. The execution of critical section request is always in the order of their timestamp.

Algorithm:

  • To enter Critical section:

    .

    • When a site Si wants to enter the critical section, it sends a request message Request(tsi, i) to all other sites and places the request on request_queuei. Here, Tsi denotes the timestamp of Site Si
    • When a site Sj receives the request message REQUEST(tsi, i) from site Si, it returns a timestamped REPLY message to site Si and places the request of site Si on request_queuej
  • To execute the critical section:
    • A site Si can enter the critical section if it has received the message with timestamp larger than (tsi, i) from all other sites and its own request is at the top of request_queuei
  • To release the critical section:
    • When a site Si exits the critical section, it removes its own request from the top of its request queue and sends a timestamped RELEASE message to all other sites
    • When a site Sj receives the timestamped RELEASE message from site Si, it removes the request of Si from its request queue

Message Complexity:
Lamport’s Algorithm requires invocation of 3(N – 1) messages per critical section execution. These 3(N – 1) messages involves


Related Solutions

1. Sort the given keys using Counting sort algorithm. Also write the algorithm.          4, 1,...
1. Sort the given keys using Counting sort algorithm. Also write the algorithm.          4, 1, 0, 2, 1, 5, 0, 4                                                                     No code or programs, please. Manually solve the problem, please. Thanks
Explain how propeller synchronization system works and also how the Synchrophasing system works. What are the...
Explain how propeller synchronization system works and also how the Synchrophasing system works. What are the benefits?
using Java, Implement the following algorithm: - Accept 5 different memory partitions and 4 different processes...
using Java, Implement the following algorithm: - Accept 5 different memory partitions and 4 different processes from user and show how best fit algorithm allocates them.
How can you generate a circle of center C and radius R using Bresenhem’s algorithm? Also,...
How can you generate a circle of center C and radius R using Bresenhem’s algorithm? Also, make flow chart for this algorithm. Write a C/C++ program to implement Bresenhem’s circle algorithm.
Discuss about different types of virtual machines and their deployment.
Discuss about different types of virtual machines and their deployment.
Trace through of Dijkstra’s Algorithm, using vertex v5 as the source vertex. Here is adjacency matrix...
Trace through of Dijkstra’s Algorithm, using vertex v5 as the source vertex. Here is adjacency matrix representing the graph with n = 6 vertices: 1 2 3 4 5 6 1 0 999 5 8 999 4 2 9 0 999 999 12 3 3 999 10 0 2 9 999 4 999 999 999 0 999 999 5 999 7 17 999 0 11 6 5 999 11 16 2 0             Initially we have: vnear = 5. Fill array...
(b) Using an appropriate diagram, demonstrate how a perfectly competitive firm achieves equilibrium in the short-run....
(b) Using an appropriate diagram, demonstrate how a perfectly competitive firm achieves equilibrium in the short-run. [7 marks]
Compare position of molecular ion peaks for (bromobenzene and 4-bromotoluene) how are they different/similar? Also, compare...
Compare position of molecular ion peaks for (bromobenzene and 4-bromotoluene) how are they different/similar? Also, compare the fragments that formed (how are they different and similar?)
Here is my algorithm: Ask how much time they need to do the assignment(Total hours) Ask...
Here is my algorithm: Ask how much time they need to do the assignment(Total hours) Ask how many days are available Calculate hour per day needed Store time needed per day in a variable 2. How many hours per day are available Store hours available per day in a variable Ask user how much time is spent doing other things Calculate how much time is available per day 24- (# of hours not available) Display how much time is available...
NOTE: this is at 5th position..not 4th Using the Hamming code algorithm (7, 4), convert a...
NOTE: this is at 5th position..not 4th Using the Hamming code algorithm (7, 4), convert a data message (0110) using 7bit. Identify the number of parity bits needed Evaluate values of parity bits Final message bits with parity bits Inject error (o or 1) at 5th position and identify the error position.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT