The goal ⛳️
In some words, the goal of this project was to create two C programs. The first is a server that orchestrate tasks that were requested from the second one - the client.
The server have the task of asynchronously execute all the tasks, being always available to receive new tasks, and managing all them in the best way.
If you want, you can read the project statement (in Portuguese).
About the Code 🧑💻
This project uses pipes and FIFOs to communicate between the client and the server.
On the server side, we implemented a pipeline feature using pipes and the dup2 function to redirect the STDOUT of one command to the STDIN of another. Additionally, we developed a Scheduler to determine the next task to execute. The scheduler employs the FCFS algorithm (with a circular queue) and the SJF algorithm, which utilizes a min-heap.
Running the project 🏃♂️
Compiling the code 🛠️
Clone the repository and navigate to the project folder:
# To work on client $ make client $ ./client/client execute < estimated time > -u < command > $ ./client/client execute < estimated time > -p < pipeline command > $ ./client/client execute 5 -u "sleep 5" # Example $ ./client/client status # To work on server $ make orchestrator $ ./server/server < output directory > < max tasks > < scheduling policy > $ ./server/server datapipe/ 3 FCFS # Example
Testing 🧪
# Compile test bins $ make compile_commands # Start the server $ ./server/server datapipe/ 3 FCFS # Example # Running test script $ ./bin/runner.sh < number of tasks to run > < order of the tasks - asc, desc, random > < minimum time > < maximum time > $ ./bin/runner.sh 4 random 1 3 # Example

