This project provides implementations of several common process scheduling algorithms in C.
The following scheduling algorithms are included:
- FIFO (First-In, First-Out): Processes are executed in the order they arrive.
- SJF (Shortest Job First): The process with the shortest execution time is executed next.
- SRT (Shortest Remaining Time): A preemptive version of SJF. The process with the shortest remaining time to completion is executed next.
- Priority Scheduling: Processes are assigned a priority, and the process with the highest priority is executed next.
- Round Robin (RR): Each process is assigned a fixed time slice (quantum) and is executed in a circular order.
- A C compiler (e.g., GCC)
To compile the scheduling algorithms, you can use the following commands. Replace ALGORITHM with the desired algorithm (e.g., FIFO, SJF).
gcc source/ALGORITHM.c -o build/ALGORITHMFor example, to compile the FIFO algorithm:
gcc source/FIFO.c -o build/FIFOTo run a compiled algorithm, provide an input file with the process details as a command-line argument.
build/ALGORITHM input.txtFor example, to run the FIFO algorithm with an input file named input.txt:
build/FIFO input.txtThe input file should contain the process information in the following format, with each process on a new line:
<pid> <arrival_time> <burst_time> <priority>
<pid>: Process ID (e.g., P1, P2)<arrival_time>: The time at which the process arrives.<burst_time>: The total time required to execute the process.<priority>: The priority of the process (lower number means higher priority).
You can use the # character to add comments to the input file.
# PID Arrival Burst Priority
P1 0 5 2
P2 1 3 1
P3 2 8 3
P4 3 6 4