100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is Turnaround Time in CPU Scheduling?

Learn what turnaround time means in OS scheduling, its formula, and how it differs from waiting time, with interview questions answered.

easyQ140 of 224 in Operating Systems Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

Turnaround time is the total time a process spends in the system, measured as completion time minus arrival time, and it includes waiting in the ready queue, executing on the CPU, and waiting for any I/O along the way.

Turnaround time captures the full lifecycle of a process from the moment it arrives in the system to the moment it finishes, so it is the sum of the time spent waiting to be scheduled, the time actually running on the CPU, and any time blocked on I/O. It is a batch-oriented metric: schedulers that minimize average turnaround time, like Shortest-Job-First, favor short jobs so more processes finish quickly, which pulls the average down even if a few long jobs take longer. Turnaround time differs from waiting time in that it includes burst time and I/O time, not just queue delay, and it differs from response time because it cares about full completion rather than the first output. Interviewers use this question to confirm a candidate can precisely define scheduling metrics rather than conflating them.

  • Formalizes completion time minus arrival time as a single metric
  • Used to compare batch scheduling algorithms objectively
  • Distinguishes full lifecycle time from queue-only waiting time
  • Basis for computing average turnaround time across a workload

AI Mentor Explanation

Turnaround time is like the total time from when a batter’s name is written on the team sheet to when they finally walk off after being dismissed or the innings ends. It counts the time spent padded up waiting in the pavilion, the time actually facing deliveries, and any rain delay in between. A scheduler that favors quick, short knocks over long occupations of the crease lowers this average across the whole team.

Step-by-Step Explanation

  1. Step 1

    Arrival

    A process enters the system and its arrival time is recorded by the scheduler.

  2. Step 2

    Waiting and execution

    The process alternates between sitting in the ready queue and running on the CPU across one or more bursts.

  3. Step 3

    Any I/O blocking

    If the process performs I/O, the time spent blocked also counts toward its total lifecycle.

  4. Step 4

    Completion

    Turnaround time is computed as completion time minus arrival time once the process fully finishes.

What Interviewer Expects

  • The exact formula: completion time minus arrival time
  • That turnaround time includes waiting, execution, and I/O time together
  • A clear distinction from waiting time and response time
  • Awareness that minimizing average turnaround time favors short jobs

Common Mistakes

  • Confusing turnaround time with waiting time alone
  • Forgetting to include I/O blocking time in the total
  • Using start time instead of arrival time in the formula
  • Assuming turnaround time applies equally well to interactive systems

Best Answer (HR Friendly)

Turnaround time is simply how long a task takes from the moment it shows up in the system to the moment it is completely finished, including all the waiting in between. It is one of the main numbers used to judge how good a scheduling policy is for batch-style workloads, where finishing jobs quickly overall matters more than any single job’s responsiveness.

Code Example

Computing turnaround time for a batch of processes
struct process {
    int pid;
    int arrival_time;
    int completion_time;
};

double average_turnaround_time(struct process procs[], int n) {
    long total = 0;
    for (int i = 0; i < n; i++) {
        int turnaround = procs[i].completion_time - procs[i].arrival_time;
        total += turnaround;
    }
    return (double) total / n;
}

Follow-up Questions

  • How does turnaround time differ from waiting time?
  • Which scheduling algorithm minimizes average turnaround time, and why?
  • Why can minimizing average turnaround time hurt long jobs?
  • How would you measure turnaround time for interactive, not batch, workloads?

MCQ Practice

1. Turnaround time is calculated as?

Turnaround time measures the full lifecycle: completion time minus the time the process arrived in the system.

2. Which of these is included in turnaround time?

Turnaround time sums every phase of a process’s lifecycle: ready-queue waits, CPU bursts, and I/O waits.

3. Which algorithm is known to minimize average turnaround time under known burst times?

Shortest-Job-First provably minimizes average turnaround (and waiting) time when burst times are known in advance.

Flash Cards

What is turnaround time?Completion time minus arrival time — the full lifecycle duration of a process.

What does turnaround time include besides CPU time?Ready-queue waiting time and any I/O blocking time.

Which algorithm minimizes average turnaround time?Shortest-Job-First, when burst times are known ahead of time.

Turnaround time vs waiting time?Turnaround includes execution and I/O; waiting time is only the ready-queue delay.

1 / 4

Continue Learning