We previously covered an example of scheduling queue in 2 Process Manager, as shown below. However, we only covered FIFO during that time.
Introduction
In particular, there are various algorithms which can be used to schedule the jobs:
- First In First Out (FIFO): Jobs are executed on a first come, first serve basis irrespective of burst time or priority.
- Last In First Out (LIFO): Jobs are executed on a last come, first serve basis irrespective of burst time or priority.
- Shortest Job First (SJB): Process with the minimum burst time at an instance executes first.
- Priority Based Scheduling (P): Each process is assigned a priority and the process with the highest priority executes first followed by the ones lower in priority.
We will implement these four different scheduling mechanisms and compare the average waiting time. Consider the following processes with the given arrival time and burst time:
Process |
Arrival Time |
Burst Time |
P1 |
0.0 |
7 |
P2 |
2.0 |
4 |
P3 |
4.0 |
1 |
P4 |
5.0 |
4 |
<aside>
<img src="/icons/map-pin_gray.svg" alt="/icons/map-pin_gray.svg" width="40px" /> The professor demonstrates the following problem just using table values. For this example, I will demonstrate it using a timeline to provide another perspective on the solution.
</aside>
A few things to note:
- The arrival time is the time at which the process enters into the ready queue is called the arrival time.
- The burst time is the total amount of time required by the CPU to execute the whole process.
- The waiting time is the total amount of time for which the process waits for the CPU to be assigned.
First In First Out