OS_Scheduler

A simulation of scheduling processes by the operating system using C language and IPCs

Table of Contents


Overview

This is our project for the Operating Systems course at Cairo University. The project simulates the work of the operating system scheduler with the processes in the system using 3 different algorithms to run the processes which are:

  1. Non-preemptive Highest Priority First (HPF)
  2. Shortest Remaining time Next (SRTN)
  3. Round Robin (RR)

While it uses 2 different algorithms for memory allocations which are:

  1. First Fit.
  2. Buddy memory allocation.

System Description

image

Data Structures

  • Priority queue

    • Ready queue: To hold the processes PCBs arranged according to the scheduling algorithm.

      Scheduling algorithm Priority queue key
      Highest priority first Processes priority
      Shortest remaining time next The remaining time (initially it’s the process runtime)
      Round robin Arriving time
    • Unallocated Processes: To hold the process that can’t be currently allocated due to memory limits

  • Linked list

    • Used in first fit memory management algorithm
    • Hole linked list: To hold the free blocks of memory and their location
    • Processes linked list: To hold the allocated processes address space
  • Binary search tree

    • Buddy lists: To hold memory addresses and specify whether they are allocated or not

How To Run

  1. Clone the project
git clone https://github.com/YaraHisham61/OS_Scheduler
  1. Go to the project directory
cd code
  1. Compile your project using the command:
make  
  1. Choose the scheduling algorithm by modifying Makefile
-sch 1 : HPF
-sch 2 : SRTN
-sch 3 : RR
  1. Choose the memory allocation algorithm by modifying Makefile
-mem 1: First fit
-mem 2: Buddy
  1. Modify process.txt to the desired test case
  2. Run your project using the command:
make run

Outputs Files

  • scheduler.log
  • scheduler.perf
  • memory.log

Contributors