3. Scheduling
Scheduling is the activity of picking a process from ready
state and allocating it to CPU.
The short term schedular is responsible for this process.
CPU utilization should be high
Turnaround time should be low
Response time should be low
Waiting time should be low
Throughput should be maximun
Performance Criteria for Scheduling
Algorithm
4. Priority Scheduling
This algorithm schedule a process based on the priority.
Out all of the available processes highest priority process gets the CPU.
If a tie occur then it follows FCFS, if again a tie occur then lowest id
process is selected.
Generally the lower the priority number, the higher is the priority of the
process.
5. Non Pre-emptive Priority Scheduling
In the non pre-emptive version of priority scheduling once a process gets the
CUP it will execute until its completion.
Example:
Process Priori
ty
AT BT CT TAT WT RT
P1 2 0 11 11 11 0 0
P2 0 5 28 39 34 6 6
P3 3 12 2 60 48 46 46
P4 1 2 10 49 47 37 37
P5 3 9 9 58 49 40 40
Total 217 189 129 129
Average 43.4 37.8 25.8 25.8
P1 P2 P4 P5 P3
0 11 39 49 58 60
6. Pre-emptive Priority Scheduling
In the pre-emptive version when a process arrive the ready state, then it is compared
with the other processes and with the process currently executing. Then the process
with highest priority is allocated the CPU.
Example:
Process Priori
ty
AT BT CT TAT WT RT
P1 2 0 11 49 49 38 0
P2 0 5 28 33 28 0 0
P3 3 12 2 60 48 46 46
P4 1 2 10 40 38 28 0
P5 3 9 9 58 49 40 40
Total 240 212 152 86
Average 48 42.4 30.4 17.2
P1 P4 P2 P4 P1 P5 P3
0 2 5 33 40 49 58 60
7. Advantages
Processes are executed based their priorities.
Provides a good mechanism where relative importance of each
process may be precisely defined
Disadvantages
If high priority process takes a lot of time, lower priority process may
starve and be postponed indefinitely. This situation is called
starvation.
Deciding which process will get which priority level.