Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q32 — CPU Scheduling

Explain with AI

Three processes AA, BB and CC each execute a loop of 100100 iterations. In each iteration of the loop, a process performs a single computation that requires tct_c CPU milliseconds and then initiates a single I/O operation that lasts for tiot_{io} milliseconds. It is assumed that the computer where the processes execute has sufficient number of I/O devices and the OS of the computer assigns different I/O devices to each process. Also, the scheduling overhead of the OS is negligible. The processes have the following characteristics: 

Process idt_ctioA100 ms500 msB350 ms500 msC200 ms500 ms\begin{array}{|c|c|c|} \hline \textbf{Process id} & \textbf{$t\_c$} & \textbf{$t_{io}$} \\ \hline \textbf{A} & \text{100 ms} & \text{500 ms} \\ \hline \textbf{B} & \text{350 ms} & \text{500 ms}\\ \hline \textbf{C} & \text{200 ms} & \text{500 ms} \\ \hline \end{array}

The processes AA, BB, and CC are started at times 00, 55 and 1010 milliseconds respectively, in a pure time sharing system (round robin scheduling) that uses a time slice of 5050 milliseconds. The time in milliseconds at which process C would complete its first I/O operation is ___________. 

View worked solution

Answer: 1000

To find the completion time of the first I/O operation of process CC, we trace the CPU scheduling using Round Robin with a time quantum of 50 ms50\text{ ms}.

The arrival times are: TA=0 msT_A = 0\text{ ms}, TB=5 msT_B = 5\text{ ms}, and TC=10 msT_C = 10\text{ ms}.

The step-by-step execution trace is as follows:

  • [0−50 ms][0 - 50\text{ ms}]: AA executes. Remaining CPU time for A=50 msA = 50\text{ ms}. Ready queue at t=50t=50: [B,C,A][B, C, A].
  • [50−100 ms][50 - 100\text{ ms}]: BB executes. Remaining CPU time for B=300 msB = 300\text{ ms}. Ready queue at t=100t=100: [C,A,B][C, A, B].
  • [100−150 ms][100 - 150\text{ ms}]: CC executes. Remaining CPU time for C=150 msC = 150\text{ ms}. Ready queue at t=150t=150: [A,B,C][A, B, C].
  • [150−200 ms][150 - 200\text{ ms}]: AA executes and completes its first CPU burst of 100 ms100\text{ ms}. AA initiates its I/O at t=200 mst = 200\text{ ms}. Ready queue: [B,C][B, C].
  • [200−250 ms][200 - 250\text{ ms}]: BB executes. Remaining CPU time for B=250 msB = 250\text{ ms}. Ready queue at t=250t=250: [C,B][C, B].
  • [250−300 ms][250 - 300\text{ ms}]: CC executes. Remaining CPU time for C=100 msC = 100\text{ ms}. Ready queue at t=300t=300: [B,C][B, C].
  • [300−350 ms][300 - 350\text{ ms}]: BB executes. Remaining CPU time for B=200 msB = 200\text{ ms}. Ready queue at t=350t=350: [C,B][C, B].
  • [350−400 ms][350 - 400\text{ ms}]: CC executes. Remaining CPU time for C=50 msC = 50\text{ ms}. Ready queue at t=400t=400: [B,C][B, C].
  • [400−450 ms][400 - 450\text{ ms}]: BB executes. Remaining CPU time for B=150 msB = 150\text{ ms}. Ready queue at t=450t=450: [C,B][C, B].
  • [450−500 ms][450 - 500\text{ ms}]: CC executes and completes its first CPU burst of 200 ms200\text{ ms}.

At t=500 mst = 500\text{ ms}, process CC initiates its first I/O operation. Since the I/O operation takes tio=500 mst_{io} = 500\text{ ms} and there is no I/O resource contention, the completion time of CC's first I/O operation is:

500 ms+500 ms=1000 ms500\text{ ms} + 500\text{ ms} = 1000\text{ ms}

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore CPU Scheduling questions