Wait time is defined as the time during which each process must wait before it receives its time slice. In scheduling algorithms such as Shorted Job First and First Come First Serve, we can easily find this waiting time, when we simply queue for work and see how long each of them had to wait before it was serviced.
When it comes to Round Robin or any other proactive algorithms, we find that lengthy work tasks spend a little time on the processor when they are unloaded, and then someday wait for it to turn on, and at some point it turns around, it runs to completion. I wanted to find a better way to understand the “waiting time” for jobs in such a scheduling algorithm.
I found a formula that gives a wait time like:
Waiting Time = (Final Start Time - Previous Time in CPU - Arrival Time)
But I do not understand the reasons for this formula. E.g. Consider work A, which has a time unit of 30 units and a circular motion occurs every 5 units. There are two more tasks B (10) and C (15).
The order in which they will be served will be:
0 A 5 B 10 C 15 A 20 B 25 C 30 A 35 C 40 A 45 A 50 A 55
Waiting time for A = 40 - 5 - 0
- I choose 40 because after 40 A never waits. He simply receives his time fragments and continues and continues.
- Choose 5 because the spent in the process prevails between 30 and 35.
- 0 - start time.
Well, I doubt this formula, why why 15 A 20 not taken into account? Intuitively, I cannot understand how this gives us the wait time for A, when we simply take into account the penultimate execution, and then subtract the arrival time.
For me, the wait time for A should be:
- The final start time is (the sum of all the processing time spent).
If this formula is incorrect, why?
Please help clarify my understanding of this concept.
algorithm operating-system
Senthil kumaran
source share