Lamport's algorithm