scheduling algorithms l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Scheduling Algorithms PowerPoint Presentation
Download Presentation
Scheduling Algorithms

Loading in 2 Seconds...

play fullscreen
1 / 33

Scheduling Algorithms - PowerPoint PPT Presentation


  • 420 Views
  • Uploaded on

Scheduling Algorithms. FCFS First-Come, First-Served Round-robin SJF Multilevel Feedback Queues. Round-Robin Scheduling. Quantum expires: move to back of ready queue Variants used in most real systems Tradeoffs: length of quantum Large: response time increases

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Scheduling Algorithms' - adamdaniel


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
scheduling algorithms
Scheduling Algorithms
  • FCFS
    • First-Come, First-Served
  • Round-robin
  • SJF
  • Multilevel Feedback Queues
round robin scheduling
Round-Robin Scheduling
  • Quantum expires: move to back of ready queue
    • Variants used in most real systems
  • Tradeoffs: length of quantum
    • Large: response time increases
    • Small: throughput decreases
      • quantum →0 = overhead dominates
      • context switches, cache misses
example round robin13

waiting

running

Example: Round-Robin
  • Fair
  • Long average wait times
round robin vs fcfs
Round-Robin vs. FCFS
  • Example 1:
    • 5 jobs, 100 seconds each, quantum = 1s
      • ignore context switch time
round robin vs fcfs15
Round-Robin vs. FCFS
  • Example 1:
    • 5 jobs, 100 seconds each, quantum = 1s
      • ignore context switch time
round robin vs fcfs16
Round-Robin vs. FCFS
  • Example 2:
    • 5 jobs: 50, 40, 30, 20, 10 seconds each, quantum = 1s
round robin vs fcfs17
Round-Robin vs. FCFS
  • Example 2:
    • 5 jobs: 50, 40, 30, 20, 10 seconds each, quantum = 1s
this time scheduling algorithms
This Time: Scheduling Algorithms
  • FCFS
    • First-Come, First-Served
  • Round-robin
  • SJF
  • Multilevel Feedback Queues
example sjf

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf20

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf21

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf22

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf23

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf24

0

10

30

60

100

150

Example: SJF
  • Schedule job with least work until I/O or done

10

20

30

40

50

example sjf25
Example: SJF
  • 5 jobs, length 50, 40, 30, 20, 10 seconds, quantum = 1s
example sjf26
Example: SJF
  • 5 jobs, length 50, 40, 30, 20, 10 seconds
sjf srtf shortest job first
SJF/SRTF: Shortest-Job First
  • Advantages:
    • Provably optimal – minimizes average waiting time
    • Works for preemptive & non-preemptive schedulers
    • Preemptive SJF = SRTF
      • Shortest remaining time first
  • Disadvantages:
    • Impossible to predict CPU time job has left
    • Long-running CPU-bound jobs can starve
this time scheduling algorithms28
This Time: Scheduling Algorithms
  • FCFS
    • First-Come, First-Served
  • Round-robin
  • SJF
  • Multilevel Feedback Queues
multilevel feedback queues mlfq
Multilevel Feedback Queues (MLFQ)
  • Use past behavior to predict future, assign job priorities
    • Overcome prediction problem in SJF
  • Assumption:
    • I/O-bound in past, I/O-bound in future
    • Scheduler favors jobs that used least CPU time
  • Adaptive:
    • Change in behavior → change in scheduling decisions
mlfq approximating sjf
MLFQ: Approximating SJF
  • Multiple queues, different priorities
    • Round-robin scheduling at each priority level
    • Run all jobs at highest priority first (till this queue is empty), then next, etc.
      • Can lead to starvation
    • Increase quantum exponentially at lower priorities
mlfq assigning priorities
MLFQ: Assigning Priorities
  • Job starts in highest priority queue
    • Quantum expires → CPU-bound
      • Drop priority one level
    • Quantum does not expire → I/O-bound
      • Increase priority one level
  • CPU-bound jobs move down,I/O-bound jobs move up
summary of scheduling algorithms
Summary of Scheduling Algorithms
  • FCFS:
    • unfair, average waiting time poor
  • Round robin:
    • fair, average waiting time poor
  • SJF:
    • unfair, minimizes average waiting time
    • requires accurate prediction
  • Multilevel Feedback Queuing:
    • approximates SJF