Lamport Mutual Exclusion Algorithm Implementation in Java
Design and implement a distributed system which consists of multiple server and client processes. Assume
that each file is replicated on all the servers, and all replicas of a file are consistent in the beginning. A client can
perform a READ or WRITE operation on the files. READ operation involves only one server that has the target file
and the server is chosen randomly by a client. WRITE involves all servers that have a copy of the target file and all
of them should be updated in order to keep the replicas consistent. READ/WRITE on a file can be performed by only
one client at a time. However, different clients are allowed to concurrently perform a READ/WRITE on different files.
In order to ensure this, implement Lamport’s mutual exclusion algorithm among clients so that no READ/WRITE
violation could occur. The operations on files (hosted by servers) can be seen as critical section executions.
To host files, create separate directory for each server. The servers must support following operations and reply to
the clients with appropriate messages –
The set of files does not change during your program’s execution. Also, assume that there is no server failure during
your program’s execution.
The clients must be able to do the following –
Before running the code, please update the below mentioned details in configuration file:
Required Argument:
Server: java -jar aos_assignment_1.jar config.properties server 1
Client: java -jar aos_assignment_1.jar config.properties client 1