The Gateway to Computer Science Excellence
+9 votes
2.7k views

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
+1
What data structure is best suited for other schedulers as well ? could you explain them as well ?
0

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.

Reference: https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/5_CPU_Scheduling.html

+10
FCFS-Oueue

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
198,591 comments
105,442 users