Skip to content

youssefchaker/process-scheduling-using-different-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Process Scheduling Algorithms

This project provides implementations of several common process scheduling algorithms in C.

Implemented Algorithms

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.

How to Compile and Run

Prerequisites

  • A C compiler (e.g., GCC)

Compilation

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/ALGORITHM

For example, to compile the FIFO algorithm:

gcc source/FIFO.c -o build/FIFO

Execution

To run a compiled algorithm, provide an input file with the process details as a command-line argument.

build/ALGORITHM input.txt

For example, to run the FIFO algorithm with an input file named input.txt:

build/FIFO input.txt

Input File Format

The 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.

Example Input File (input.txt)

# PID  Arrival  Burst  Priority
P1 0 5 2
P2 1 3 1
P3 2 8 3
P4 3 6 4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages