The purpose of this algorithm is to ensure that distributed processes do not access a shared resource (critical section) at the same time. This is accomplished by making use of Lamport Timestamps to assign every request a time value. Before a process enters the critical section, it waits on acknowledgments from every other process. Once finished, it lets all the other processes know that it is done, and they each remove that request from their queues; then, the next waiting process enters the critical section.
Algorithm pseudocode:
Pi: (initially timestamp = 0)
on event e:
case e is send(msg)
timestamp = timestamp + 1
msg.timestamp = timestamp
case e is receive(msg)
timestamp = max(timstamp, msg.timestamp)
timstamp = timestamp + 1
case e is any other event
timestamp = timestamp + 1
e.timestamp = timestamp