in Operating System
10,031 views
13 votes
13 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
10.0k views

1 comment

RoundRobin uses time-slice to give equal priority status to each and every process.

So, executing after that time bound units, each process is preempted.Hence it uses a Circular Queue

0
0

2 Answers

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

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.
16
16
Thank you!
0
0
3 votes
3 votes
Yes, it should be Circular Queue.

Since it is given that there are n processes in the ready queue, we do not have to worry about the overflow in the circular queue also.

2 Comments

thank you . I just want to verify ! :)
0
0
why cant it be simply 'queu' instead of 'circular queu'?
0
0
Answer:

Related questions