Our implementation is a UDP based approach to the Ricart-Agrawala algorithm for mutual exclusion on a distributed system
The program consists of two golang files;
- shared_resource.go -> Represents the critical section of the system
- client.go -> Represents the nodes in the system
To run the program, first run the shared_resource.go
$ go run ./Implementation/shared_resource.go
Next open multiple terminals that you would like to use as clients.
Client.go takes multiple arguments, depending on the number of clients.
- The first argument is the id of the client you want to initialize.
- The second (and other) argument(s) is the port on localhost on which the clients will operate.
Under here is an example of executing three different clients (each client to be executed in its own terminal).
$ go run ./Implementation/client.go 1 8080 8081 8082
$ go run ./Implementation/client.go 2 8080 8081 8082
$ go run ./Implementation/client.go 3 8080 8081 8082
To make a request to access the critical section, write the command request within a terminal executing the client.
$ request
- Gustav Christoffersen - [email protected]
- Jacob Walter Bentsen - [email protected]
- Markus Grand Petersen - [email protected]
As research on the topic, we gained some insight and references by looking at implementations by DylanNS and joaopmgd