The usual method of computing average time, average wait time, turnaround time and average turnaround time for processes is to make a Gantt Chart and then compute these times.
In this post, we explore another way to compute the average turn around time and average wait time for processes based on the same logic given by the specific algorithms.
Popular CPU scheduling algorithms are as follows
- First Come, First Serve
- Shortest Job First
- Priority Scheduling
- Round Robin
We will compute the average turnaround time and average wait time for the processes using the tabular method.
First Come, First Serve
At first, make a table as follows, with processes ordered in the way they arrive in the queue.
The first column is for processes in the ready queue and listed in the order as they arrive. The arrival of all three processes is 0.
- Fill the first row with burst time of process P1.
- Fill the second row with burst time of process P2 because it starts after P1.
- Similarly, fill the burst time of P3 in the third row last column because P3 start after P2 process.
- Each column is Turnaround time for each process in the queue.
First Come, First Serve with Change in Order
Average Waiting Time = (0 + 3 + 6)/3 = 3 ms
In the above example, process P3 is the first, process P2 is second and process P4 is the third in that order. We already know the wait time of the process P3 = 0 because it is the first process to arrive in the queue.
For turnaround time take the total of row “Total” and divide by 3 will give you the answer and for the average waiting time, the sum of first two columns of the row “Total” divided by 3 will give you the answer.
First Come, First Serve with different Arrival Times
To compute the average turnaround time and average waiting time using the tabular method. Draw following table but this time we have different arrival times for each process.
Abraham Silberschatz, Peter B. Galvin, Greg Gagne, A Silberschatz. 2012. Operating System Concepts, 9th Edition. Wiley.