Skip to content

This project uses Python to implement and simulate 4 process scheduling algorithms: FIFO, Preemptive SJF, Round Robin, and Lottery Scheduler. The script will read process data from an input file, execute the scheduling algorithms, calculate turnaround, waiting, and response times, and output the results to a file.

Notifications You must be signed in to change notification settings

Israel-Charles/The-Multi-Process-Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The-Multi-Process-Scheduler

This software implements 4 process scheduling algorithms: FIFO (First In, First Out), Pre-emptive Shortest Job First (SJF), Round Robin (RR), and Lottery Scheduler. The implementation should be able to simulate the scheduling of multiple processes under each algorithm and calculate their turnaround time, response time, and wait time. The following key components are required:

  • Process Data Structure: Representing each process with its arrival time, execution time, and status.
  • Scheduler Functions: One function for each algorithm to handle a list of processes and implement the respective scheduling logic.
  • Time Slice Parameter: A Q-value for the Round Robin algorithm to determine the maximum time a process can run before being preempted.
  • Metric Calculation Functions: Functions to compute turnaround time, waiting time, and response time for each process.

To Run the Program

Note that the final file includes all the depencies in one file
Some test input files can be found in the Test_Files Folder

python3 <input_file.in>

Input File Format

The input file will have the following format:

processcount <number of processes>
runfor <total number of time units to run>
use <algorithm> [quantum <time units>] (if using Round Robin)
process name <name> arrival <arrival time> burst <burst time>
...
end

Output File Format

The output file will document the events and results as follows:

<Number of processes> processes
Using <algorithm that is being used>
[Quantum <time units> (if using Round Robin)]
Time <time unit>: <event status>
...
Time <final time unit>:  <event status>
Finished at time <total time units>

<process name> wait <waiting time> turnaround <turnaround time> response <response time>
...
[<process name> did not finish (if there is a process that did not finish within the allocated time)]
...

Some Error Handling

Handled gracefully with specific messages:

  • Missing parameter: "Error: Missing parameter "
  • Missing quantum for Round Robin: "Error: Missing quantum parameter when use is 'rr'"
  • No input file: "Usage: scheduler-gpt.py "

About

This project uses Python to implement and simulate 4 process scheduling algorithms: FIFO, Preemptive SJF, Round Robin, and Lottery Scheduler. The script will read process data from an input file, execute the scheduling algorithms, calculate turnaround, waiting, and response times, and output the results to a file.

Topics

Resources

Stars

Watchers

Forks

Languages