Priority Based Scheduling
- Each process is assigned a priority. Process with highest priority is to be executed first and so on.
- Processes with same priority are executed on first come first serve basis.
- Priority can be decided based on memory requirements, time requirements or any other resource requirement.
Example:
Process | Arrival Time | Execute Time | Priority | Service Time |
---|---|---|---|---|
P0 | 0 | 5 | 1 | 0 | P1 | 1 | 3 | 2 | 3 | P2 | 2 | 8 | 1 | 8 | P3 | 3 | 6 | 3 | 16 |
P3 |
P1 |
P0 |
P2 |
0 | 6 | 9 | 14 | 22 |
Wait time of each process is following
Process | Wait Time : Service Time - Arrival Time |
---|---|
P0 | 0 - 0 = 0 |
P1 | 3 - 1 = 2 |
P2 | 8 - 2 = 6 |
P3 | 16 - 3 = 13 |
Average Wait Time: (0+2+6+13) / 4 = 5.25