1. Gyanastra
  2. Operating Systems
  3. CPU Scheduling
  4. Completion Time, Turnaround Time and Waiting Time
Free lesson, no account needed 6 min read 14 practice questions after it
Asked in past papers13 times
  • GATE CSE20212019201620112007200419931988
  • ISRO2014
  • UGC NET2023201920172013

Operating Systems · CPU Scheduling

Completion Time, Turnaround Time and Waiting Time

Overview

CPU scheduling analysis measures how long a process spends in the system.
Under the simplifying assumption of no I/O, the total time between a process's arrival and its completion splits cleanly into CPU execution (burst time) and waiting in the ready queue (waiting time), which gives the core relationships between completion time, turnaround time and waiting time.

Key concepts

  • Burst time (BT): The amount of CPU time a process requires for execution.
    It is the CPU time the process needs for its execution, so in practice it is tricky to know in advance because it must be predicted before running the process.
  • Completion time (CT): The point in time at which the process finishes execution and reaches the termination/completed state.
  • Arrival time (AT): The point in time at which the process arrives in the system.
  • Waiting time (WT): The time a process spends waiting for the processor in the ready queue.
  • Turnaround time (TAT): The difference between the arrival time and the completion time of a process; the total time from when the process arrived to when it completed.
  • Points in time vs durations: Completion time and arrival time are points in time; waiting time and burst time are durations of time. Taking the difference between two points in time yields a duration.

How it works

  1. A process arrives, enters the ready state, waits in the ready queue, is scheduled into the running state, executes on the CPU, and finally reaches the termination state when it completes.
  2. All problems are considered under the assumption that a process needs only CPU time. I/O time is not considered because including I/O would complicate the analysis.
  3. Because there is no I/O, the process cannot be blocked. The only states considered are new, ready, running, and termination, which keeps the timing relationships simple.
  4. Between arrival and completion, the process first waits for the processor in the ready queue and then executes.
    It may wait and execute in different intervals; it need not have only one waiting period followed by one execution period. This depends on the scheduling policy, i.e. whether it is preemptive or non-preemptive.
  5. Completion time minus arrival time is the total time the process spent in the system.
    Under the no-I/O assumption, the process does only two things in that time: it executes on the CPU (burst time) and it waits in the ready queue (waiting time). Therefore Completion time - Arrival time = Burst time + Waiting time.
  6. The same difference, Completion time - Arrival time, is called the turnaround time — the total time from arrival to completion.
  7. Out of the entire turnaround time, the process executes only for its burst time; the remaining time is spent waiting for the CPU. Waiting time is therefore obtained by subtracting burst time from turnaround time.

Formulas

  • Symbols: AT = arrival time (point in time when the process arrives); CT = completion time (point in time when the process finishes/terminates); BT = burst time (duration of CPU execution required); WT = waiting time (duration spent waiting for the CPU in the ready queue); TAT = turnaround time (total duration from arrival to completion).
TAT = CT - AT
CT - AT = BT + WT
TAT = BT + WT
WT = TAT - BT
  • Equivalently:
BT = TAT - WT

Worked examples

No process table or numerical example is worked out in this section. The conceptual example given is:

  • Suppose Completion time - Arrival time = 1 hour.
  • In that one hour, under the no-I/O assumption, the process would have done only two things:
    • executed for its burst time, and
    • waited in the ready queue for the remaining time.
  • Hence that one hour equals Burst time + Waiting time, which is also the turnaround time.
Gantt chart: Completion Time, Turnaround Time and Waiting Time
Figure. Completion Time, Turnaround Time and Waiting Time

Comparison

QuantityTypeMeaning
Arrival timePoint in timeTime at which the process arrives
Completion timePoint in timeTime at which the process finishes and terminates
Burst timeDurationCPU execution time required by the process
Waiting timeDurationTime spent waiting for the CPU in the ready queue
Turnaround timeDurationCompletion time - Arrival time

Revision summary

  • Burst time is the CPU time required by a process and is difficult to know before execution.
  • Completion time is the time at which the process finishes execution.
  • The analysis assumes no I/O time, so there is no blocked state.
  • Between arrival and completion, a process either waits in the ready queue or executes on the CPU.
  • Completion time and arrival time are points in time; waiting time and burst time are durations.
  • Turnaround time = Completion time - Arrival time.
  • Under the no-I/O assumption, Completion time - Arrival time = Burst time + Waiting time, so Waiting time = Turnaround time - Burst time.
  • A process may alternate between waiting and execution depending on whether the scheduler is preemptive or non-preemptive.

Previous-year exam insights

  • Average waiting time = (sum of waiting times of all processes)/number of processes;
    average turnaround time = (sum of turnaround times)/number of processes.
    Waiting time of a process = (time it finishes) - (arrival time) - (total CPU burst).
    Asked inGATE 2019GATE 2016GATE 2011GATE 2004UGC NET 2023UGC NET 2019UGC NET 2017
  • To compute waiting/turnaround times for preemptive SJF (SRTF) or round robin, draw a Gantt chart: at each arrival or completion (and at each time-quantum expiry for RR) preempt if a newly arrived process has a shorter remaining burst; a process's waiting time is the sum of all intervals it spent in the ready queue.
    Asked inGATE 2019GATE 2016GATE 2011GATE 2004UGC NET 2023UGC NET 2019UGC NET 2017
  • Scheduling optimization criteria: maximize CPU utilization and throughput; minimize turnaround time, waiting time and response time.
    (Minimizing CPU utilization is not a criterion.)
    Asked inGATE 2021ISRO 2014
  • Turnaround time = waiting time + burst time (+ I/O time if any), so turnaround time always includes waiting time;
    response time is the time from arrival to the first time the process gets the CPU, which differs from waiting time in preemptive/round-robin scheduling.
    Asked inGATE 2021
  • To minimize the weighted mean completion time (sum wiw_{i}*TiT_{i} / sum wiw_{i}) on a single processor, execute jobs in non-increasing order of wiw_{i}/tit_{i} (Smith's rule); for equal weights this reduces to shortest-job-first, i.e. non-decreasing burst time.
    Asked inGATE 2007
  • In round robin, a process that finishes exactly at the end of its time quantum is not re-queued; the ready queue order and the quantum length determine the waiting times, and average turnaround time is always at least the average burst time.
    Asked inUGC NET 2019
Pages 1–2 of 2