IAE Academy

GATE 2020 CS Q.12: solution and answer

GATE 2020 · CSQ.12 · 1 mark · MCQ

Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.

Which of the above statements are TRUE?

  1. (A)

    I, II, and III only

  2. (B)

    II and III only

  3. (C)

    I, II, and IV only

  4. (D)

    I, II, III, and IV

See the question in the paper

Answer and solution

ANSWER

Statements I, II and IV are true, so the answer is option (C), I, II, and IV only.

Official answer: CSource: Official answer key, GATE 2020 CS (IIT Delhi)

  1. Draw the five-state process model: New, Ready, Running, Blocked (Waiting), Terminated. The system uses preemptive scheduling, so a running process can be forced off the CPU.

  2. Statement I: when a time slice expires or a higher-priority process arrives, the running process is preempted and goes back to the ready queue, Running Ready. TRUE.

  3. Statement II: the dispatcher picks a process from the ready queue and gives it the CPU, Ready Running. TRUE.

  4. Statement III: a blocked process is waiting for an event such as I/O completion. Even after the event occurs, it must first join the ready queue and wait for the dispatcher. There is no direct Blocked Running edge. FALSE.

  5. Statement IV: when the awaited I/O or event completes, the process moves Blocked Ready. TRUE.

  6. So I, II and IV are true and III is false. This is option (C).

KEY IDEA

A blocked process can only go to Ready when its event completes. Only the dispatcher moves a process from Ready to Running. Preemption adds the Running Ready edge.

WATCH OUT FOR

Assuming a process whose I/O has finished resumes running at once (Blocked Running). It must wait in the ready queue first, because the CPU may be held by another process.

From the GATE 2020 CS paper. Every question of this paper · Download the full paper · All 9 Processes & threads questions, with notes

More Processes & threads questions