1. LPU MCA Semester 1
  2. CAP366
  3. Unit 4

CAP366 · Unit 4: CPU scheduling

Types of scheduling and scheduling criteria

12 practice questions · in the MTE and ETE syllabus

Key points

  • Preemptive vs non-preemptive decision points
  • Maximise utilisation and throughput
  • WT = TAT - BT; TAT = CT - AT
  • Response = first CPU time - arrival

Scheduling decisions occur when a process (1) goes Running to Waiting, (2) Running to Ready, (3) Waiting to Ready, (4) terminates. A non-preemptive scheme schedules only in cases 1 and 4; a preemptive scheme may also act in cases 2 and 3.

Criteria: maximise CPU utilisation and throughput; minimise turnaround, waiting and response time.

MeasureFormula
Turnaround timeCompletion time - arrival time
Waiting timeTurnaround - burst (no I/O)
Response timeFirst CPU time - arrival time

Example: arrival 2, burst 6, completion 15 gives turnaround 13, waiting 7.

Exam pitfall: under FCFS with no preemption and no I/O, response time equals waiting time, but for round robin they usually differ. Interactive systems care most about response time.

Try two questions

Question 1 · Tier 2, Understand

Which pair of criteria should a CPU scheduler try to maximise?

  1. CPU utilisation and throughput
  2. Waiting time and response time
  3. Turnaround time and waiting time
  4. Throughput and turnaround time
Show the answer

A. Utilisation and throughput are maximised, while turnaround, waiting and response time are minimised.

Why not B: These are to be minimised, since lower values are better.

Why not C: Both are to be minimised.

Why not D: Turnaround time is minimised, so it does not belong with throughput here.

Question 2 · Tier 4, Analyse

Each process spends 70 percent of its time waiting for I/O, and the system keeps 3 such processes in memory at once. What is the approximate CPU utilisation?

  1. 30.0%
  2. 34.3%
  3. 65.7%
  4. 90.0%
Show the answer

C. The CPU is idle only if all 3 wait, which has probability 0.7^3 = 0.343, so utilisation is 1 - 0.343 = 65.7 percent.

Why not A: This is the utilisation with only one process in memory.

Why not B: This is the probability that all three are computing, not the CPU use.

Why not D: This adds 30 percent three times, which ignores overlap of the waits.