Throughput vs turnaround time vs waiting time vs response time

Introduction

Throughput, turnaround time, response time and waiting time are frequently mentioned terms in operating systems. They may look similar but they refer to different methods for evaluating CPU scheduling algorithms. When multiple processes are running, the CPU has to determine which process runs next in order to utilize resources and optimize system performance. For example, some processes spend more time doing IO which takes long time, other processes take more CPU time so it does not make sense for an IO bound process to block other process from having access to the CPU. Depending on operating system design goals and behavior of the running processes different parameters can be computed to get an idea how the system is performing. Here is a quick summary of these parameters if you are in rush, for details please continue reading.

ParameterDescription
ThroughputNumber of completed processes per time unit
Waiting timeTime a process waits in the ready state
Turnaround timeTime a process takes from submission to completion
Response timeTime between a command request and the beginning of a response

Throughput

Imagine a post office with multiple counters serving people. Throughput in this case is the number of people served in an hour (for example). As you can see, throughput gives us a sense of how efficient the post office is even though different customers take different times depending on their specific needs. Similarly, in OS context, throughput refers to the number of completed processes in a given amount of time. Let us take an example, assume we have 3 processes that we need to run in the order they arrive. The first process (P1) takes 5 seconds to finish, the second process (P2) takes 15 seconds and the third process (P3) takes 10 seconds. Throughput in this case: (5 + 15 + 10)/3 = 10 (on average, one process is completed every 10 seconds).

Waiting time

This parameter refers to the amount of time a given ready process sits in the waiting queue before getting the attention of the CPU. Let us compute the waiting time for our example (Order of arrival P1, P2, P3 each taking 5, 15, 10 seconds). The waiting time for P1 is 0 because it is the first process that has arrived. P2 waits 5 seconds and P3 waits 5 + 15 = 20 seconds. So the average waiting time is (0 + 5 + 20)/3 = 8.3 seconds.

Turnaround time

Turnaround refers to the time a given process takes from submission to completion. Let us take the same example that we discussed previously. Order of arrival was P1, P2, P3 each taking 5, 15, 10 seconds. The first process takes 5 seconds to finish from submission to completion. The second process takes (5 + 15 = 20) seconds from submission to completion. We add 5 because P2 has to wait for P1 to finish. Similarly, the third process takes (5 + 15 + 10 = 30) seconds from submission to completion. Again, the third process has to wait for both P1 and P2 to finish. In this case, the average turn around time is (5 + 20 + 30)/3 = 18.3 seconds. Note that if we change the algorithm from first come first serve to some other scheduling algorithm or if we change the order in which the processes arrive we may get a different average turn around. You can think of the turn around time as the sum of waiting time and execution time.

Response time

Response time is the time difference between the issuance of a command and the start of a response to that command. Even though it may look similar to waiting time yet it is a different parameter because a given process may take extra time after leaving the ready state until it gets the attention of the CPU depending on which scheduling algorithm is implemented. Also, this parameter is more relevant when talking about interactive systems where you issue a command and wait the beginning of the output. In other words, it is the time difference between arrival time and the first execution time.

Summary

In this short post, we discussed some CPU scheduling performance metrics. Depending on operating system design goals (ex. batch system, real time system, etc.) and scheduling algorithm (First come first serve, round robin, etc.) one or more parameters can be computed to see how the system is performing. Generally speaking, minimum waiting time is needed so that processes won’t wain longer in the ready state. Maximum throughput is needed to complete as many processes as possible in a given period of time (ex. batch system). Response time should be as small as possible so that a process gets the attention immediately (ex. interactive system).

If you have questions or comments, please use the comments section below. Thanks for visiting.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *