|
1 | 1 |
|
| 2 | +# Part 1 – CPU Scheduling Algorithms |
| 3 | + |
| 4 | +### 📌 Operating System Design Project – Fall 2024 | University of North Texas |
| 5 | +🧑🏫 Instructor: Prof. Amar M. Maharjan |
| 6 | +📁 Project 5 of 6 | Focus: CPU Scheduling Strategy Implementation & Evaluation |
| 7 | + |
| 8 | +This project simulates five classical CPU scheduling algorithms using C++ to understand their behavior in handling process execution. The algorithms are tested using 15 input files containing process details such as burst time and priority, simulating workloads with 6, 10, and 16 processes. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 🧠 Algorithms Implemented |
| 13 | + |
| 14 | +1. **FCFS (First-Come First-Served)** – Non-preemptive, executes processes in arrival order. |
| 15 | +2. **SJF (Shortest Job First)** – Non-preemptive, selects the shortest burst time first. |
| 16 | +3. **Priority Scheduling** – Non-preemptive, executes processes based on assigned priority. |
| 17 | +4. **Round Robin (RR)** – Preemptive, time-sharing model with a defined time quantum. |
| 18 | +5. **Priority + Round Robin** – Hybrid: processes are ordered by priority and executed using RR among equal-priority tasks. |
| 19 | + |
| 20 | +Each algorithm is implemented in its own C++ source file located in the `code/` directory. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 📂 Folder Structure |
| 25 | + |
| 26 | +``` |
| 27 | +Part1/ |
| 28 | +├── code/ |
| 29 | +│ ├── fcfs.cpp |
| 30 | +│ ├── sjf.cpp |
| 31 | +│ ├── priority.cpp |
| 32 | +│ ├── rr.cpp |
| 33 | +│ ├── priority_rr.cpp |
| 34 | +│ └── input/ # All 15 test input files |
| 35 | +├── docs/ |
| 36 | +│ └── Project_Report_OSD_part1.pdf |
| 37 | +└── README.md # This file |
| 38 | +``` |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 🧪 Input Format |
| 43 | + |
| 44 | +Each line in the input file represents a process with 3 space-separated values: |
| 45 | + |
| 46 | +``` |
| 47 | +<ProcessID> <Priority> <BurstTime> |
| 48 | +``` |
| 49 | + |
| 50 | +Example: |
| 51 | +``` |
| 52 | +P1 2 10 |
| 53 | +P2 1 4 |
| 54 | +P3 3 5 |
| 55 | +``` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## ▶️ How to Compile and Run |
| 60 | + |
| 61 | +Compile the desired algorithm file: |
| 62 | + |
| 63 | +```bash |
| 64 | +g++ fcfs.cpp -o fcfs |
| 65 | +./fcfs input/schedule6Ex1.txt input/schedule10Ex1.txt ... |
| 66 | +``` |
| 67 | + |
| 68 | +Replace `fcfs.cpp` with any other algorithm file (`sjf.cpp`, `priority.cpp`, etc.) as needed. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## 📊 Results Summary (Average Waiting Time) |
| 73 | + |
| 74 | +| Algorithm | 6 Procs | 10 Procs | 16 Procs | |
| 75 | +|------------------------|---------|----------|----------| |
| 76 | +| FCFS | 44.17 | 83.24 | 136.26 | |
| 77 | +| SJF | 32.67 | 65.88 | 109.49 | |
| 78 | +| Priority | 50.20 | 81.66 | 138.10 | |
| 79 | +| Round Robin | 58.20 | 121.50 | 200.71 | |
| 80 | +| Priority + Round Robin | 50.73 | 82.44 | 138.16 | |
| 81 | + |
| 82 | +📌 **Observation:** SJF consistently results in the least average wait time across all input sizes. |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 📄 Documentation |
| 87 | + |
| 88 | +Detailed analysis, graphs, and evaluation insights are available in the PDF report. |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## 🧑💻 Contributors ( each contributed majorly in this project) |
| 93 | + |
| 94 | +- Ganesh Gundekarla |
| 95 | +- Shreya Sri Bearelly |
| 96 | +- Divya Sree Dandu |
| 97 | +- Vikas Varala |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 🧠 References |
| 102 | + |
| 103 | +- Operating System Concepts, Silberschatz, Galvin & Gagne (10th Edition) |
| 104 | +- IEEE Research Papers on Scheduling Efficiency & Heuristics |
| 105 | + |
0 commit comments