Project 2
Instructor: Prof. Neeraj Mittal
Author: Malay Virendra Bhavsar (MXB230055)
This individual project aims to implement a distributed mutual exclusion service using Roucairol and Carvalho’s algorithm, providing cs-enter() and cs-leave() functions for process synchronization. Developed in Java (Version 22.0.2), the project emphasizes socket programming and distributed communication, running exclusively on the dcXX.utdallas.edu
machines.
The project comprises several essential components:
- Node: Sets up Client, Server instances; manages the configuration file.
- Server: Oversees incoming communications and directs them appropriately.
- Client: Manages outgoing communications, including sending key, requesting key. Also performs Critical Section Cycle (Blocking)
- Message: Establishes a structured format for inter-process message exchange.
- Tester: Processes the generated CS output and verdit weather it follows Mutual Exclusion or not.
The project is divided into four main segments:
- Part 1: Implement a distributed system with
n
nodes, each able to send and recieve messages. - Part 2: Implement Roucairol and Carvalho’s algorithm to syncronize the process.
- Part 3: Generate output in the format
{nodeId} {Scalar Clock Value} {CS_completed}
. - Part 4: Testing for Critical Section Overlap.
The project utilizes a plain-text configuration file formatted as follows:
- The first line contains six tokens:
Number of nodes
Request Delay
Critical Section Execution Time
Number of Critical Sections per Request
- The next
n
lines specify node details:nodeId
hostname
port
For a configuration file named <config_name>.txt
with n
nodes, the program will generate a output files named aos2.txt
. Each file contains nodeId, scalar clock timestamps for each critical section and the number of critical sections completed by process.
Example Output:
0 0 0
1 1 0
0 3 1
2 4 0
- Ensure you have Java Development Kit (JDK) 22.0.2 installed.
- This project must be executed on the machines
dcXX.utdallas.edu
(where XX ∈ {01, 02, ..., 45}).
-
Create a project directory:
mkdir aos-project2 cd aos-project2
-
Place all project files (including the configuration file) in this directory.
-
Compile the project:
javac *.java
- Clean up before and after running the program:
chmod +x cleanup.sh
./cleanup.sh
- Run the program:
chmod +x launcher.sh
./launcher.sh
- Run the Test program:
java Tester
- Perform cleanup after use:
./cleanup.sh
To connect to the server at dcXX.utdallas.edu
, use the following command (omit the password):
ssh <your-username>@dcXX.utdallas.edu
Ensure that you replace with your actual username. After connecting, you can navigate to your project directory to compile and run your code.
The ./launcher.sh
and ./cleanup.sh
scripts are provided by the professor. All credits go to the respective owners for these contributions.
This project aims to provide a robust and efficient solution for distributed mutual exclusion, leveraging established algorithms and modern programming practices to ensure correctness, performance, and usability.
If you have any questions or require further assistance, please don't hesitate to reach out!