Skip to content

Harry830/OS-Project-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS Scheduler & Memory/Paging Simulator

Java Status

A small Java program that simulates classic CPU scheduling (FCFS, Priority), prints a text Gantt chart, and calculates WT/TAT/CPU Utilization. It also includes Memory Allocation (First/Best/Worst Fit) and Paging (FIFO) demos.


✨ Features

  • Scheduling: FCFS, Priority (non-preemptive; lower number = higher priority)
  • Metrics: Waiting Time, Turnaround Time, Averages, CPU Utilization
  • Gantt Chart: Text-based like | P1 | P2 | ... with times underneath
  • Memory: First-Fit, Best-Fit, Worst-Fit (fixed blocks typed by user)
  • Paging: FIFO page replacement (Belady anomaly demo ready)

🚀 Quick Start

# compile
javac OS_Simulation.java

# run (menu)
java OS_Simulation

When asked for the input file, press Enter to use processes.txt at the project root, or type a path.

Sample Runs

# FCFS with baseline set
copy data/processes_baseline.txt processes.txt   # Windows (PowerShell: cp)
cp data/processes_baseline.txt processes.txt     # macOS/Linux
java OS_Simulation
# choose: 1

# Priority (non-preemptive)
java OS_Simulation
# choose: 2

# Memory (try first/best/worst)
cp data/processes_mem_diff.txt processes.txt
java OS_Simulation
# choose: 3
# blocks: 60,70,100,25
# method: first (or best / worst)

# Paging (Belady refs: 3 frames vs 4)
cp data/references_belady.txt references.txt
java OS_Simulation
# choose: 4
# frames: 3  -> faults ~ 9
# frames: 4  -> faults ~ 10  (worse with more frames)

If IntelliJ can't find processes.txt, set Run → Edit Configurations → Working directory = $ProjectFileDir$.


📂 Repo Layout

.
├── OS_Simulation.java         # single-file Java program (entrypoint: main)
├── processes.txt              # default input (you can swap from /data)
├── references.txt             # default paging refs (you can swap from /data)
├── data/
│   ├── processes_baseline.txt
│   ├── processes_idle_gaps.txt
│   ├── processes_ties.txt
│   ├── processes_no_mem_column.txt
│   ├── processes_mem_diff.txt
│   ├── references_fifo1.txt
│   └── references_belady.txt
└── docs/
    └── report_student.md


About

Submission for OS Project 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages