Welcome to CPU Scheduling Simulator’s documentation!

_

Indices and tables

Demo

src.app.main()[source]
Demo
  • This function runs sample (random) testcase with 7 process to demonstrate the app
  • Plots the gantt chart for each algorithm
  • Plots the comparision graph for different algorithms
to Run Demo:
  • unzip the project.
  • In the project base directory
    • configure Python virtual Environment.
      • create virtual env : python3 -m venv env
      • switch to environment.
        • Linux : source env/bin/activate
        • Win : run the activate script in cmd at env/sources/activate and then change back to the root directory.
    • install dependencies
      • pip install -e .
  • in the project root directory run python main.py
FCFS Shortest Remaining Time First Priority Non-Preemptive Priority Preemptive Shortest Remaining Time First Round Robin Comparison of Scheduling Algorithms

Process

class src.utils.process.Process(p_id, arrival_time, burst_time, priority=1)[source]
Args:
  • p_id (int) : process ID
  • arrival_time (int) : process Arriva time in ready queue
  • burst_time (int) : Burst Time
  • priority (int) : priority of the process , default: 1
Defaults:
  • self.waiting_time = 0
  • self.return_time = 0
  • self.turnaround_time = 0
  • self.response_time = 0
  • self.completed = False

_

Scheduling Algorithms

All the algorithms expects:
Args:
processes (src.utils.process.Process): An array of process to be scheduled.
Returns:

Dictionary. the result of the scheduling:

{
   'name': 'Algo Name',
   'avg_waiting_time': total_waiting_time/len(proc),
   'avg_response_time': total_response_time/len(proc),
   'avg_turnaround_time': total_turnaround_time/len(proc),
   'processes': proc, # modified scheduled processes
   'gantt': gantt # gantt chart array
}
src.algorithms.fcfs.run(processes)[source]

First Come First Serve

_

src.algorithms.sjf.run(processes)[source]

Shortest Job First

_

src.algorithms.priority.run(processes)[source]

Priority Scheduling

_

src.algorithms.srtf.run(processes)[source]

Shortest Remaining Time First

_

src.algorithms.priority_preemptive.run(processes)[source]

Priority Preemptive

_

src.algorithms.round_robin.run(processes, quantum=3)[source]

Round Robin

_

_

Tables

src.utils.table.plot(processes)[source]

Displays the given processes in a tabular format

Args:
processes (Array : src.utils.process.Process): processed processes.

_

Graphs

Visual representation of Scheduling Algorithms

src.utils.graph.plot_algo_graph(result)[source]

Plots the line graph for a particular scheduling algorithm.

Args:
result (Dictionary) : return value of any scheduling process.
src.utils.graph.plot_comparision(algorithms)[source]

Plots the Comparison Bar graph for different scheduling algorithms.

Args:
result (Array : Dictionary) : Array of return values of any scheduling process.
src.utils.graph.plot_gantt(result)[source]

Plots the Gantt Chart for a particular scheduling algorithm.

Args:
result (Dictionary) : return value of any scheduling process.