Round Robin RR Scheduling - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Round Robin RR Scheduling

Description:

Each process gets a small unit of CPU time (time quantum or time slice), usually ... After the time quantum has elapsed, the process is preempted and added to the ... – PowerPoint PPT presentation

Number of Views:4135
Avg rating:3.0/5.0
Slides: 10
Provided by: marily214
Category:

less

Transcript and Presenter's Notes

Title: Round Robin RR Scheduling


1
Round Robin (RR) Scheduling
  • Designed for time-sharing systems
  • The algorithm
  • Each process gets a small unit of CPU time (time
    quantum or time slice), usually 10-100
    milliseconds.
  • After the time quantum has elapsed, the process
    is preempted and added to the end of the ready
    queue (an FIFO queue).
  • Essentially FCFS scheduling with preemption
  • If there are n processes in the ready queue and
    the time quantum is q, then response time is no
    more than (n-1)q
  • Smaller q ? smaller response time, but more
    context switches
  • Performance of RR depends on size of time quantum
  • q large same as FCFS
  • q small each of the n processes has the
    impression that it has its own processor running
    at 1/n the speed of the real processor
  • q must be large with respect to context switch
    time, otherwise overhead is too high.

2
Example of RR with Time Quantum 20
  • Process Burst Time
  • P1 53
  • P2 17
  • P3 68
  • P4 24
  • The Gantt chart is

3
Time Quantum and Context Switch Time
4
Turnaround Time Varies With The Time Quantum
Rule of thumb 80 of CPU bursts should be
shorter than the time quantum
5
Multilevel Queue Scheduling
  • Ready queue is partitioned into separate queues
    each process is permanently assigned to one queue
    based on some property of the process (e.g.,
    process type)
  • E.g., separate queues for foreground
    (interactive) processes and background (batch)
    processes
  • Each queue has its own scheduling algorithm
  • E.g., foreground RR, background FCFS
  • Scheduling must be done between the queues.
  • Fixed priority preemptive scheduling
  • E.g., foreground queue has absolute priority over
    background queue
  • Possibility of starvation.
  • Time slice between the queues each queue gets a
    certain amount of CPU time
  • E.g., 80 CPU time to foreground in RR, 20 to
    background in FCFS

6
Example of Multilevel Queue Scheduling
7
Multilevel Feedback Queue Scheduling
  • A process can move between the various queues
  • A process will be moved to a lower-priority queue
    if it uses too much CPU time
  • A process that waits too long in a lower-priority
    queue may be moved to a higher priority queue ?
    prevent starvation
  • Multilevel feedback queue scheduler defined by
    the following parameters
  • number of queues
  • scheduling algorithm for each queue
  • when to upgrade a process to a higher-priority
    queue
  • when to demote a process to a lower priority
    queue
  • how to select the initial queue for a process
  • The most general and most complex scheduling
    algorithm

8
Example of Multilevel Feedback Queue
  • Three queues with fixed priority preemptive
    scheduling among them
  • Q0 (highest priority) RR, time quantum 8
    milliseconds
  • Q1 RR, time quantum 16 milliseconds
  • Q2 (lowest priority) FCFS
  • Scheduling algorithm
  • A new job enters Q0 , which is served FCFS. When
    the job gains CPU, it receives 8 milliseconds.
    If it does not finish in 8 milliseconds, it is
    moved to the tail of Q1.
  • At Q1 job is again served FCFS and receives 16
    additional milliseconds. If it does not
    complete, it is preempted and moved to Q2.

9
Example of Multilevel Feedback Queues
Write a Comment
User Comments (0)
About PowerShow.com