O.S.F. Carvalho and G. Roucairol. On Mutual Exclusion in Computer Networks (Technical Correspondence). Communications of the ACM, February 1983.
* Java-8
* Ubuntu
* Shell script
AOS & AOSServer Folder contains the source files for Client & Server respectively
- Java-8
- MultiThreading and Socket Programming
- Basic Data Structures and Protocol understanding
This is an interesting algorithm which takes <= 2(N-1) messages to enter the critical Section, unlike Lamports Mutex which utilizes 3(N-1). For more details read Project_1 Description.pdf
-
If you run directly after Unzipping the code, the code should run fine. Check the filePaths and if you have password less login setup.
automates spawning of terminals without physically entering them -
The project is created in Eclipse, therefore launcher.sh and launchServer.sh after execution compiles the code to /bin directory. Change the shell scripts if you don't want it to compile the source code.
-
Changing UIDs to a different order than 0 1 2 3 4 , throws exception.
-
Authorize, reply deferred, using, waiting information is implemented as arrays for simplicity, not HashMaps.
-
The Given code will not work in LocalHost. Check the other branch to test it on the Windows LocalMachine
-
configAOS.txt should have unique DC Machine as their hostname. Code will not work if 2 UIDs have same hostname
-
File Server HostName and Ports are harcoded in the RicartAgrawala.java for simplicity
-
ParseConfigFile.java reads lines from readFile.txt in a specified format. Check the code for more understanding.
-
Unzip or clone the project.
-
Update the respective paths in configAOS.txt & configAOSServer.txt to select the paths for your Servers to host the files (Path should be inside the DC Machine). No need to create directories, code takes care of it. Config files guide the shell script to the locations of each node in the network.
-
As per the project description Executing the code on DC machines is mandatory. Make sure you have password less login setup before you run the Shell script. Details can be found below. ( To access DC Machines you have to be a UTD Student )
-
Update the paths inside ParseConfigFile.java, readFile.txt.
-
Config files and shell scripts will only be in your local machine All the code will reside in the Server. Copying the files in csgrads1 will update the code in all DC machines as DC Machine implements Distributed Shared File System
-
Push the code in csgrads1.utdallas.edu, by using winscp or sftp
-
Give executable permission to the scripts
$chmod +x *.sh
-
Compiles the java code ( You can ignore this step, if you are using launcher.sh and launchServer.sh.
The shell scripts will compile the code and execute )$ cd AOS $ javac -cp "./bin" -d "./bin" ./src/*.java $ cd ../AOSServer $ javac -cp "./bin" -d "./bin" ./src/*.java
-
"launchServer.sh" will setup the terminals for Server
"launch.sh" sets up the terminals for Clients
"cleanup.sh" closes all the ssh connections of the terminals -
Open a terminal and go into the directory of shell scripts. Obviously, always launch the Servers first.
$ ./launchServer.sh
-
Open a terminal and go into the directory of shell scripts
$ ./launch.sh
-
Terminals will pop up and start executing the code. In the end, view your files in the Server. All the respective files will have the same values.
-
Open a terminal and go into the directory of shell scripts
$ ./cleanup.sh
This will terminate all the spawned terminals.
- The Details of the Project Description can be found in Project_1 Description.pdf
Note: $ is a prompt in the terminal: Ignore $ while copying these commands into the terminal
- Open the terminal in your local machine, type
$ cd
$ cd .ssh
Now you'll be in the .ssh directory
- Type
$ ssh netid@dc01.utdallas.edu
- if prompted,
Are you sure you want to continue connecting (yes/no)?
Type yes, then enter
- enter password
dc01: will be your current system.
- Type
$ cd .ssh
Now you'll be in dc01/.ssh directory
- Type
$ ssh-keygen -t rsa
Just press enter for passphrase … …
The key fingerprint is: … something … , hit enter
The keys randomart image is: … … (special image), hit enter
- type
$ cat id_rsa.pub >> authorized_keys
- type
$ exit
Now you'll be in .ssh directory in your local Machine.
- type
$ sftp netid@dc01.utdallas.edu
Enter your password
- Type
sftp> cd .ssh
Now you'll be in dc01/.ssh directory
- Type
sftp> get id_rsa
id_rsa file will be copied into your .ssh directory in local machine
- Type
$ exit
Now you'll be in your local machine
- You dont have to enter password to enter to any dc machine from your local machine now.
Some effort in refactoring can make this code really elegant.
So, I'd appreciate any suggestions