A CPU scheduler determines an order for the execution of its scheduled processes; it decides which process will run according to a certain data structure that keeps track of the processes in the system and their status.
A process, upon creation, has one of the three states: Running, Ready, Blocked (doing I/O, using other resources than CPU or waiting on unavailable resource).
Consider a Computer with 1-CPU and fixed size memory (1024 ==> can be changed). Our scheduler implemented the complementary components as sketched in the following diagrams.
📌 NOTE:
We are supporting the following Scheduling algorithms:
- HPF (Highest Priority First)
- STRN (Shortest Time Remaining Next)
- RR (Round Robin)
Algo/Part | DS |
---|---|
Processes WTA | Linked list |
HPF - SRTN | Priority queue |
RR - Waiting list | Queue |
Buddy | Binary tree |
- Algo Explanation:
-
Recieve and process all processes which come in the current second 1. In case of free space: Allocate space for it and push it in the ready queue 2. Else: Push it in the waiting list
-
Check the running process if it finishes or not 1. True: Free its allocated space and check the waiting list 2. False: Pass (continue the code flow)
-
Check if the ready queue is not empty:
- True: based on the algo, we decide that we will switch or not
-
Wait till the next second
-
- HPF Algorithm
- SRTN Algorithm
- Round Robin Algorithm
Abdallah Hemdan |
Adel Mohamed |
Ahmed Sherif |
Ahmed Mahboub |