Skip to content

CPU scheduling algorithm program to calculate processes' process time

License

Notifications You must be signed in to change notification settings

Amir-Shamsi/cpu-scheduling-algorithm

Repository files navigation

CPU Scheduling Algorithm (os simulator)

cpu-scheduling-algos

Python version BSD Licence Follow me Project Initiator Repo Size

This is an OS simulation that has been implemented by the CPU scheduling algorithms such as:

  • First Come, First Serve (FCFS)
  • Round Robin (RR)
  • Shortest Job First (SJF)
  • MultiLevel Feedback Queue (MLFQ) :
    • First queue: RR Time Quantum 8 ms
    • Second queue: RR with time Quantum 16 ms
    • Third queue: FCFS


cpu-scheduling-algos


Program Input

Input data must be entered through a comma-separated values (.csv) and the columns must be like this:

process_id arrival_time cpu_time1 io_time cpu_time2
1 1 2 3 4
2 12 3 4 1
3 5 4 5 3
4 13 4 5 15
5 13 5 6 7

you can see and download test file here

Program Output

  1. the program will process the processes and will calculate the following information:
    • Response Time
    • Turnaround Time
    • Waiting Time
    • Process' Start Time
    • Process' End Time
  2. after running the algorithms for each process these parameters will be shown for the algorithm:
    • Total Time and Idle Time
    • Average Waiting Time
    • Average Response Time
    • Average Turnaround Time
    • CPU Utilization
    • Throughput

example of round robin algorithm's output:

output

Installation

Below is an example of how you can clone and run the project on your local.

  1. Clone the repo
    git clone https://github.com/Amir-Shamsi/cpu-scheduling-algorithm.git
  2. Install required libraries
    pip install -r requirement-libs.txt
  3. Make a coffee and enjoy! ☕🍪

(back to top)