Logo
Fab.Magalhães

Software Engineer

Operating System Process Orchestrator: Knowing More About The OS System Calls, Multithreading and Synchronization

March 28, 2024Software Development, Course, Project, Learning, Multithreading
MacBook Mockup Background
https://mackgame4-portfolio.vercel.app
Technologies

C, Shell, Makefile, System Calls, Threading, Synchronization

Team

Afonso Pedreira, Dário Guimarães, Fábio Magalhães

Timeline & Status

Delivered Jun 11, 2024

Source

https://github.com/Mackgame4/UM-os-process-orchestrator

Overview

This project was developed for the Sistemas Operativos course at the Universidade do Minho as part of a Software Engineering degree. It involves creating a process orchestrator in C that manages multiple processes using system calls over the OS.

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 🏃‍♂️

Running the orchestratorMP4
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