The Gateway to Computer Science Excellence
+9 votes

Suppose a system contains $n$ processes and system uses the round-robin algorithm for CPU scheduling then which data structure is best suited ready queue of the process

  1. stack
  2. queue
  3. circular queue
  4. tree
in Operating System by Veteran (106k points) | 2.7k views

1 Answer

+16 votes
Best answer

Circular queue is the best data structure for round-robin CPU scheduling algorithm .

In round-robin CPU scheduling if the timer goes off first, then the process is swapped out of the CPU and moved to the back end of the ready queue.

The ready queue is maintained as a circular queue, so when all processes have had a turn, then the scheduler gives the first process another turn, and so on.

So option C is correct.

by Boss (38.7k points)
selected by
What data structure is best suited for other schedulers as well ? could you explain them as well ?

I'm no expert, but I can answer your question with some confidence.

For FCFS scheduling, FIFO queue is used.

For SJF (non-preemptive) and priority, a priority queue (min-heap) is used.



SJF-Min heap

Round Robin-Circular queue

LJF-Max heap

Priority-Priority queue.
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,391 answers
105,442 users