written 7.2 years ago by | • modified 7.2 years ago |
Mumbai University > Information Technology > Sem 5 > Operating System
Marks: 6M
Year: May 2016
written 7.2 years ago by | • modified 7.2 years ago |
Mumbai University > Information Technology > Sem 5 > Operating System
Marks: 6M
Year: May 2016
written 7.2 years ago by |
A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms.
There are six popular process scheduling algorithms which we are going to discuss in this chapter −
These algorithms are either non-preemptive or preemptive. Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time, whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state.
First Come First Serve (FCFS)
Wait time of each process is as follows −
Process | Wait Time : Service Time - Arrival Time |
---|---|
P0 | 0 - 0 = 0 |
P1 | 5 - 1 = 4 |
P2 | 8 - 2 = 6 |
P3 | 16 - 3 = 13 |
Average Wait Time: (0+4+6+13) / 4 = 5.75
Shortest Job Next (SJN)
Wait time of each process is as follows −
Process | Wait Time : Service Time - Arrival Time |
---|---|
P0 | 3 - 0 = 3 |
P1 | 0 - 0 = 0 |
P2 | 16 - 2 = 14 |
P3 | 8 - 3 = 5 |
Average Wait Time: (3+0+14+5) / 4 = 5.50