The last level - lowest priority - will be "BACKGROUND" scheduled. In this case, prcesses will only receive processor time when there are no ready processes at any other level.
There are 8 priority levels, from 0 to 7.
Among all of the processes at other priority levels, there will be a more even-handed approach to scheduling. Among the quantum-ing variables will be following: priority, waiting time.
quantum = ((priority levels - task priority) * ratio ) + waiting time.
This means that the inverse of the process priority will be multiplied by "ratio", and to that will be added the current waiting time.
For example:
TASK1 : priority = 1, waiting time = 4
TASK2 : priority = 2, waiting time = 6
thenTASK1 quantum = ( ( 8 - 1 ) * 3) + 4 = 25 <- winner
TASK2 quantum = ( ( 8 - 2 ) * 3) + 6 = 24
That means TASK1 win TASK1 : priority = 1, waiting time = 3
TASK2 : priority = 2, waiting time = 10
thenTASK1 quantum = ( ( 8 - 1 ) * 3) + 3 = 24
TASK2 quantum = ( ( 8 - 2 ) * 3) + 10 = 28 <- winner
In the second case, task 2 gets to run since it has been waiting long enough to overcome task 1's higher priority. This possibility helps to ensure that no processes will stop.
No comments:
Post a Comment