Skip to content

goncalofssousa/multi-runner-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Runner Command Orchestration Environment

Overview

This repository contains a Multi-Runner Command Orchestration System developed in C for Linux as part of the Operating Systems (Sistemas Operativos) course at the University of Minho.

The project implements a client-server architecture using two distinct programs—runner and controller—that interact via Named Pipes (FIFOs) to manage, schedule, and execute user bash commands concurrently.

Architecture & Features

1. The Controller

  • Acts as a central orchestrator daemon.
  • Receives execution and status requests concurrently from multiple runner processes without blocking.
  • Implements custom scheduling policies to guarantee fairness among different user IDs.
  • Manages parallel task execution based on a user-defined max concurrency limit.
  • Logs execution statistics (User ID, Command ID, and total duration) persistently to a file.

2. The Runner

  • Acts as the client interface for users to submit bash commands (-e), check the status of running/queued tasks (-c), or safely shut down the controller (-s)
  • Communicates intended execution requests to the controller and waits for authorization before triggering command execution
  • Displays real-time state updates to the user via stdout (submitted, executing, finished)
  • Advanced I/O Support: Implements process redirection and communication operators, supporting >, 2>, <, and |

Technical Implementation (OS Primitives)

This project was built from scratch without using forbidden functions such as system() or direct shell invocations. It actively utilizes core Operating Systems concepts learned in the course:

  • Low-level I/O: open, read, write, and close system calls
  • Inter-Process Communication (IPC): Named Pipes (mkfifo) to establish asynchronous communication channels between clients and the server, and anonimous pipes (pipe) to implement communication operator |
  • Process Management: fork and exec family calls to create process hierarchies for executing commands.
  • Signal Handling & Redirection: dup2 for pipe and file redirection operators.

Getting Started

Prerequisites

  • Linux Environment
  • GCC Compiler & Make

Usage Examples

  1. Starting the Controller
./bin/controller <max-parallel-commands> <sched-policy>
  1. Executing Commands (Runner)
./bin/runner -e 1 "echo hello"
  1. Commands with pipes and redirections:
./bin/runner -e 2 "grep system /etc/passwd | wc -l > out.txt"
  1. Inspecting the Queue status
./bin/runner -c
  1. Safe Shutdown
./bin/runner -s

About

A multi-runner command orchestration system under Linux using C, named pipes (FIFOs), and custom scheduling policies. University project for Operating Systems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors