Arrival, burst, completion, turnaround, waiting, & response time

When we start learning about CPU scheduling algorithms, we come across some terms that are very confusing. This includes terms like arrival time, burst time, completion time, turnaround time, waiting time, and response time.

These calculations judge the efficiency of a scheduling algorithm. You can find their definitions and examples below.

Arrival time

The arrival time of a process is when a process is ready to be executed, which means it is finally in a ready state and is waiting in a queue for its turn to be executed.

Each process has a pre-determined arrival and burst time, as highlighted in the table below. The arrival time for processes 1, 2, 3, and 4 is 0, 0, 3, and 5 seconds respectively.

Burst time

The burst time of a process is the number of time units it requires to be executed by the CPU. In the table below, the burst time is also written for each of the four processes.

Completion time

The completion time is the time when the process stops executing, which means that the process has completed its burst time and is completely executed.

Exit time

The exit time is when a process has been fully executed and permanently leaves the waiting queue.

P1P1P1P2P2P2P3P3P3P4P4P4P2P3P4
Gantt Chart (Each cell represents 1 second of CPU time)

Turnaround time

Turnaround time is the duration between the arrival of a process into the waiting queue until it exits the waiting queue completely. To calculate the turnaround time for a process, we can use two formulas:

TurnaroundTime=BurstTime+WaitingTimeTurnaroundTime = Burst Time + Waiting Time

OR:

TurnaroundTime=ExitTimeArrivalTimeTurnaroundTime = ExitTime - Arrival Time

Example

To understand turnaround time better, we can use the table above. If we use the Robin Hood scheduling method and keep the time quantumthe amount of time that a process is permitted to run equal to 3 seconds, we get the final Gantt Charta way of displaying activities against time in process scheduling as shown above. We can then calculate the turnaround time for each of the processes using the first formula:

P1: 3 + 0 = 3 seconds
P2: 4 + 9 = 13 seconds
P3: 4 + 7 = 11 seconds
P4: 4 + 6 = 10 seconds

Waiting time

The waiting time of a process is the time it waits between its arrival in a waiting queue and the time it is fully executed. Hence, waiting time is:

WaitingTime=ExitTimeArrivalTimeBurstTimeWaitingTime = ExitTime - ArrivalTime - BurstTime

Example

Using the example similar to turnaround time, we can calculate the waiting time for each of the processes.

P1: 0 seconds
P2: 9 seconds
P3: 7 seconds
P4: 6 seconds

Response time

The response time is the duration between a process’s arrival into the waiting queue and when it gets the CPU for the first time.

ResponseTime=ProcessGetsCPUArrivalTimeResponseTime= ProcessGetsCPU - Arrival Time

Example

Using the example similar to turnaround time, we can calculate the response time for each of the processes.

P1: 0 seconds
P2: 3 seconds
P3: 3 seconds
P4: 4 seconds

Copyright ©2024 Educative, Inc. All rights reserved