AhmedNazir

Call

Option 4 : P = 3, Q = 7, R = 7, S = 3

The correct answer is option 4.

Concept:

The round-robin algorithm is a preventative algorithm. After a defined interval of time, the CPU is transferred to the next process, which is known as time quantum/time slice. The preempted process gets moved to the end of the queue. The round-robin model is a clock-driven hybrid model.

Explanation:

The given data, Given four processes P, Q, R, and S.
Scheduling algorithm: Round Robin
Time quantum = 4-time units.
All the processes arrive at time t = 0.

  • Exactly one context switch from S to Q.
  • Exactly one context switch from R to Q.
  • Exactly two contexts switch from Q to R.
  • No context switch from S to P.
  • Switching to a ready process after the termination of another process is also considered a context switch.

Analysis:

Different Gantt charts of different processes,

Option 1: P = 4, Q = 10, R = 6, S = 2

Time quantum = 4-time units.

True,  It is a possibility as the CPU bursts time of these processes and accepts all context switches.

P Q R S Q R Q
0-4 4-8 8-12 12-6 16-20 20-21 21-25

Option 2: P = 2, Q = 9, R = 5, S = 1

Time quantum = 4-time units.

True,  It is a possibility as the CPU bursts time of these processes and accepts all context switches.

P Q R S Q R Q
0-2 2-6 6-10 10-11 11-15 15-16 16-17

Option 3:P = 3, Q = 7, R = 7, S = 3

Time quantum = 4-time units.

True,  It is a possibility as the CPU bursts time of these processes and accepts all context switches.

P Q R S Q R Q
0-4 4-8 8-12 12-14 14-18 18-20 20-22

Option 4:P = 3, Q = 7, R = 7, S = 3

Time quantum = 4-time units.

False, there is no context switching exist from R to Q. Hence it is not a possibility as CPU burst time of these processes.

P Q R S Q R
0-3 3-7 7-11 11-14 14-17 17-20

Hence the correct answer is P = 3, Q = 7, R = 7, S = 3.

Talk Doctor Online in Bissoy App