Skip to content

Shpetim10/Operating-Systems-Final-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operating Systems Final Project

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:

  1. shell scripts are measured and optimized as small system-level workloads;
  2. classical synchronization problems are implemented with POSIX threads and Java monitors;
  3. scheduling is studied with a multilevel feedback queue simulator and queueing formulas.

Repository Structure

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

Requirements

The project was prepared to run on macOS or Linux.

Needed tools:

  • Bash
  • make
  • C compiler such as cc, clang, or gcc
  • Java JDK for the Java synchronization programs
  • Python 3.9 or newer

No Python packages are required for the scheduler simulator.

Quick Run

Build the C and Java programs:

make build

Run the main verification checks:

make test

Run the main experiment commands:

make paper1
make paper2
make paper3

Generated CSV files are saved in results/.

Paper 1: Shell Script Analysis and Optimization

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.sh
  • src/paper1/optimized/collatz.sh
  • src/paper1/baseline/blank_rename.sh
  • src/paper1/optimized/blank_rename.sh
  • src/paper1/optimized/mailformat.sh
  • src/paper1/optimized/soundex.sh
  • src/paper1/optimized/crt_solver.sh
  • src/paper1/optimized/life.sh
  • src/paper1/optimized/resource_log_analyzer.sh
  • src/paper1/tools/benchmark_shell.sh

Example:

src/paper1/tools/benchmark_shell.sh

This 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: Synchronization Experiments

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/java

Examples:

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 1

Each program prints CSV-style output so it can be copied directly into result tables.

Paper 3: Scheduling and Queueing Simulation

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.csv

Run the queueing-theory output:

python3 src/paper3/scheduler_sim.py --queueing --output results/paper3_queueing.csv

The simulator checks that all jobs finish and that the executed CPU service matches the generated burst workload.

Notes for Reproducibility

  • 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.

Cleanup

make clean

This removes compiled binaries, Java class files, and generated result CSV files.

About

This is a repository for final project on Operating Systems course

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors