A simple command scheduling system written in C for Linux.
The project is composed of two programs, runner and controller, that communicate through named pipes/FIFOs. Users submit commands with the runner, while the controller manages scheduling and controls how many commands can run at the same time.
The system works with one central controller process and multiple runner processes.
When a user submits a command, the runner sends a request to the controller. The controller stores the request, applies the selected scheduling policy, and authorizes the command when it can run.
After receiving permission, the runner executes the command and notifies the controller when it finishes. The controller also keeps track of running and waiting commands, so users can check the current state of the system.
Supported scheduling policies:
- Round-Robin
- MLFQ
- Stride
- FCFS
- Random
.
├── bin/ # Compiled binaries
├── include/ # Header files
├── logs/ # Logs generated by the controller
├── obj/ # Object files
├── scripts/
│ ├── plots/ # Plots generated by Python
│ ├── analyze_logs.py # Log analysis and plot generation script
│ ├── run_tests.sh # General test script
│ ├── scenario_stride.sh
│ ├── scenario_rr.sh
│ └── scenario_mlfq.sh
├── src/ # Source code
│ ├── controller/
│ ├── pipes/
│ ├── runner/
│ └── utils/
├── tmp/
└── Makefile
make clean
make./bin/controller <max-parallel> <policy>Available policies: round-robin, mlfq, stride, fcfs and random.
Example:
./bin/controller 3 round-robin./bin/runner -e <user-id> <command>Example:
./bin/runner -e 1 echo helloExample with pipes and redirection:
./bin/runner -e 1 "grep system /etc/passwd | wc -l > out.txt"./bin/runner -c./bin/runner -sThe test scripts compile the project automatically and clean the logs before each run.
Inside the scripts directory:
chmod +x <script_name>.sh
./<script_name>.shExample:
chmod +x run_tests.sh
./run_tests.shAfter running the test scripts:
python3 scripts/analyze_logs.pypip3 install matplotlib numpyThis project was developed for Linux and uses system calls such as fork, exec, wait, mkfifo, open, read and write.