Skip to content

simulate a CPU scheduling system with SRTF , FCFS and RR Methods

Notifications You must be signed in to change notification settings

Ali-Noghabi/CPU-scheduling-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Scheduling Simulation

This project simulates various CPU scheduling algorithms. These algorithms are critical in operating systems for managing how processes access the CPU. The implemented scheduling methods are:

  • Shortest Remaining Time First (SRTF)
  • First Come First Serve (FCFS)
  • Round Robin (RR)
  • Shortest Job First (SJF)
  • Shortest Process Next (SPN)
  • Non-preemptive Priority Scheduling

Project Overview

This project allows you to understand and visualize how different CPU scheduling algorithms work. By simulating these algorithms, you can compare their performance based on metrics such as average waiting time and turnaround time.

Implemented Scheduling Algorithms

First Come First Serve (FCFS)

FCFS is the simplest scheduling algorithm. In this method, the process that arrives first gets executed first. It operates in a non-preemptive manner.

For more details, visit the FCFS Documentation.

Round Robin (RR)

RR scheduling assigns a fixed time unit per process, and cycles through them. It is designed to be fair, giving each process a chance to run.

For more details, visit the Round Robin Documentation.

Shortest Job First (SJF) & Shortest Process Next (SPN)

SJF, also known as SPN, selects the process with the smallest burst time to execute next. This can be non-preemptive or preemptive.

For more details, visit the SJF Documentation and the SPN Documentation.

Shortest Remaining Time First (SRTF)

SRTF is a preemptive version of SJF. It selects the process with the smallest remaining time to execute next.

For more details, visit the SRTF Documentation.

Non-preemptive Priority Scheduling

In this method, each process is assigned a priority. The CPU is allocated to the process with the highest priority (the smallest priority number).

For more details, visit the Priority Scheduling Documentation.

Tests and Verification

The output of each scheduling algorithm is verified using an external tool for accuracy.

FCFS Test

Output:

FCFS Output

Verification:

FCFS Verification

RR Test

Output:

RR Output

Verification:

RR Verification

SJF & SPN Test

Output:

SJF & SPN Output

Verification:

SJF & SPN Verification

SRTF Test

Output:

SRTF Output

Verification:

SRTF Verification

Priority Scheduling Test

Output:

Priority Output

Verification:

Priority Verification

Running the Project

Prerequisites

Steps to Run

  1. Compile the Code:

    rustc main.rs
  2. Run the Executable:

    ./main.exe

Contributing

If you want to contribute to this project, please fork the repository and submit a pull request with your improvements.

About

simulate a CPU scheduling system with SRTF , FCFS and RR Methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages