in Operating System
7,425 views
11 votes
11 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
2699 3558 3939
7.4k views

Subscribe to GO Classes for GATE CSE 2022

1 Answer

18 votes
18 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.

selected by
by
64 160 378

4 Comments

What data structure is best suited for other schedulers as well ? could you explain them as well ?
1
1

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

0
0
FCFS-Oueue

SJF-Min heap

Round Robin-Circular queue

LJF-Max heap

Priority-Priority queue.
13
13
Thank you!
0
0
Answer:

Related questions