In: Computer Science
Priority = (recent CPU usage / 2 ) + base
where base = 60 and recent CPU usage refers to a value indicating how often a process has used the CPU since priorities were last recalculated.
Assume that recent CPU usage for process P1 is 40, process P2 is 18, and process P3 is 10.
Round Robin Scheduling (RR) per priority is suitable for interactive computing. It is made possible by multi-level feedback scheduling. It adjusts the priority dynamically and main aim is to place process automatically based on the recent CPU usage. Thus it avoids the problem of starvation to an extent. Eventhough if there are a number of interactive process will becomes ready for execution then it becomes difficult and it can be solved by aging process
In priority scheduling , the process with highest priority will be the first one to be executed. Priority is defined by an integer number , low value indicates higher priority. i.e. priority number 1 indicates higher priority. As the priority number increases priority decreases. Priority can be static or dynamic.
Static priority remains until end of the process execution.
Dynamic priority means the priority will change during the execution of processes. This is to increase the efficiency of scheduling algorithms.
If a high priority process is CPU bound (Uses more CPU time) then the lower priority process has to wait a lot leads to starvation. All these issues can be solved by recalculating process priority once per second by the scheduler.
In priority related scheduling, priority number is inversely proportional to the priority of a process. Priority is calculated using the formula
Priority = (recent CPU usage /2) + base
base = 60
CPU usage for P1 = 40
P2 = 18
P3 = 10
a) Recalculated Priority
Process P1 , Priority = (40/2) + 60
= 20 + 60
= 80
Process P2 , Priority = (18/2) + 60
= 9 + 60
= 69
Process P3 , Priority = (10/2) + 60
= 5 + 60
= 65
From this calculation, we can conclude that process with lower priority value is executed first. i.e. process P3 is executed initially, beacuse P3 is the process with lower priority value.
b) Based on the calculated priority we can analyse that, Traditional UNIX scheduler lowers the relative priority of a CPU bound process. CPU bound process will move to lower priority level and interactive process remains in higher level with less CPU burst time.