Prepared by Shpëtim Shabanaj and Artjol Zaimi
Course: CEN-308 Operating Systems
Academic year: 2025-2026
This repository contains the practical part of our Operating Systems final project. The three reports are included in docs/reports, and the source code used for the experiments is organized by paper under src/.
The main idea of the project is to connect OS theory with runnable experiments:
- shell scripts are measured and optimized as small system-level workloads;
- classical synchronization problems are implemented with POSIX threads and Java monitors;
- scheduling is studied with a multilevel feedback queue simulator and queueing formulas.
docs/reports/
assignment-brief.pdf
paper1-shell-optimization.pdf
paper2-synchronization.pdf
paper3-scheduling-queueing.pdf
data/
paper1/ sample email, log, and Game of Life input
src/
paper1/ shell scripts and benchmark harness
paper2/c/ pthread producer-consumer and dining philosophers
paper2/java/ Java monitor implementations
paper3/ MLFQ and queueing simulator
tests/
test_scheduler_sim.py basic correctness checks for the scheduler simulator
results/
generated CSV results are written here
The project was prepared to run on macOS or Linux.
Needed tools:
- Bash
make- C compiler such as
cc,clang, orgcc - Java JDK for the Java synchronization programs
- Python 3.9 or newer
No Python packages are required for the scheduler simulator.
Build the C and Java programs:
make buildRun the main verification checks:
make testRun the main experiment commands:
make paper1
make paper2
make paper3Generated CSV files are saved in results/.
Paper 1 focuses on shell scripting as OS automation. The repository includes baseline and optimized scripts for the selected examples, plus a benchmark harness.
Important files:
src/paper1/baseline/collatz.shsrc/paper1/optimized/collatz.shsrc/paper1/baseline/blank_rename.shsrc/paper1/optimized/blank_rename.shsrc/paper1/optimized/mailformat.shsrc/paper1/optimized/soundex.shsrc/paper1/optimized/crt_solver.shsrc/paper1/optimized/life.shsrc/paper1/optimized/resource_log_analyzer.shsrc/paper1/tools/benchmark_shell.sh
Example:
src/paper1/tools/benchmark_shell.shThis writes timing results to:
results/paper1_benchmark.csv
The optimized scripts try to reduce unnecessary subprocesses, avoid repeated pipes in hot loops, and use Bash built-ins when they are clearer and faster.
Paper 2 compares producer-consumer and dining philosophers implementations. The C programs use pthread mutexes and condition variables. The Java programs use synchronized monitor methods.
Build:
make -C src/paper2/c
make -C src/paper2/javaExamples:
src/paper2/c/pc_pthreads 4 4 256 100000
src/paper2/c/dp_hierarchy 5 1000 50 50
src/paper2/c/dp_semaphore 5 1000 50 50
cd src/paper2/java
java ProducerConsumer 4 4 256 100000
java DiningMonitor 5 1000 1 1Each program prints CSV-style output so it can be copied directly into result tables.
Paper 3 uses a Python simulator for round-robin and MLFQ scheduling. The optimized MLFQ configuration follows the report:
Q1 = 8, Q2 = 40, L1 = 40, L2 = 120, T = 1000
Run default scheduler comparison:
python3 src/paper3/scheduler_sim.py --trials 20 --jobs 80 --output results/paper3_scheduler.csvRun the queueing-theory output:
python3 src/paper3/scheduler_sim.py --queueing --output results/paper3_queueing.csvThe simulator checks that all jobs finish and that the executed CPU service matches the generated burst workload.
- Random experiments use fixed seeds unless changed from the command line.
- The scripts write outputs to
results/so the raw runs are kept separate from the source code. - The report PDFs are included in the repository to make the final submission self-contained.
- The sample datasets are small on purpose, but the commands accept larger inputs for screenshots and final result tables.
make cleanThis removes compiled binaries, Java class files, and generated result CSV files.