https://github.com/sarahabuirmeileh/cpu-scheduling-algorithms
c++ implementation for some of CPU scheduling algorithms with some calculated statistics, Gantt chart drowing and reading the data from files
https://github.com/sarahabuirmeileh/cpu-scheduling-algorithms
cplusplus cpu cpu-scheduling fcfs fcfs-process-scheduling fcfs-scheduling os round-robin round-robin-scheduler round-robin-scheduling roundrobin sjf sjf-algorithm sjf-process-scheduling sjf-scheduling srt srt-scheduling
Last synced: 3 months ago
JSON representation
c++ implementation for some of CPU scheduling algorithms with some calculated statistics, Gantt chart drowing and reading the data from files
- Host: GitHub
- URL: https://github.com/sarahabuirmeileh/cpu-scheduling-algorithms
- Owner: SarahAbuirmeileh
- Created: 2024-05-15T12:56:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-15T15:27:48.000Z (about 1 year ago)
- Last Synced: 2025-01-16T01:15:02.299Z (4 months ago)
- Topics: cplusplus, cpu, cpu-scheduling, fcfs, fcfs-process-scheduling, fcfs-scheduling, os, round-robin, round-robin-scheduler, round-robin-scheduling, roundrobin, sjf, sjf-algorithm, sjf-process-scheduling, sjf-scheduling, srt, srt-scheduling
- Language: C++
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Process Scheduling Algorithms ⚙️💻
This repository contains C++ implementations of various process scheduling algorithms:* First Come First Serve (FCFS)
* Shortest Remaining Time First (SRT)
* Round Robin (RR)
* Shortest Job First (SJF)## Description 🎯
Each algorithm is implemented in its respective file. The main program, main.cpp, reads process information from input files, simulates the scheduling algorithms, and prints out the results.## Files 🗂
* PCB.h: Defines the Process Control Block (PCB) structure used to represent individual processes.
* PCBFuns.h: Contains helper functions used in scheduling algorithms.
* algorithms.cpp: Contains implementations of the scheduling algorithms.
* main.cpp: The main program that orchestrates the simulation and prints results.
* processes/: Directory containing input files for different scheduling algorithms.## How to Use 👩🏻💻
1. Compilation: Compile the program using a C++ compiler. For example:
```g++ main.cpp -o scheduler```2. Input Files: Prepare input files in the processes/ directory. Each input file should follow the format specified below:
```php
```
3. Execution: Run the compiled program, providing the number of processes as a command-line argument. For example:4. Output: The program will display Gantt charts and various statistics for each scheduling algorithm.
## Input File Format 📑
Each input file should contain the following information:* The first line specifies the context switch time and quantum time.
* Each subsequent line represents a process, with the following fields separated by spaces:
* * Process ID
* * Arrival time
* * CPU burst time
* * Size in bytes
* Example input file (FCFS.txt):```yaml
2 4
1 0 8 1024
2 1 6 512
3 3 10 2048
```## Output 💻
The program generates Gantt charts and calculates the following statistics for each scheduling algorithm:* Average Waiting Time
* Average Turnaround Time
* CPU Utilization Rate