1 / 34

Scheduling: The Multi-Level Feedback Queue

Scheduling: The Multi-Level Feedback Queue. SeongJae Park (sjpark@dcslab.snu.ac.kr) School of Computer Science and Engineering Seoul National University. MLFQ: Multi-Level Feedback Queue. Described by Corbato et al. in 1962 “An Experimental Time-Sharing System”

noreenc
Download Presentation

Scheduling: The Multi-Level Feedback Queue

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scheduling:The Multi-Level Feedback Queue SeongJae Park (sjpark@dcslab.snu.ac.kr) School of Computer Science and Engineering Seoul National University

  2. MLFQ: Multi-Level Feedback Queue • Described by Corbato et al. in 1962 • “An Experimental Time-Sharing System” • Goal 1: Short turnaround time • SJF(Shortest-Job First) do best for the goal • However, could not know whether a job is will finish soon or not • Goal 2: Minimal response time • Users should receive response to their keyboard / mouse input quickly

  3. MLFQ: Basic Rule A job have priority If Priority(A) > Priority(B), A runs If Priority(A) == Priority(B), A & B runs in Round-Robin

  4. MLFQ: Priority Implementation Q8 A B Higher Priority Q7 C … Q1 D Insert Jobs with same priority in same queue

  5. MLFQ v1: Priority Change If Priority(A) > Priority(B), A runs If Priority(A) == Priority(B), A & B runs in Round-Robin When a job enters the system, it is placed at the highest priority If a job uses up an entire time slice while running, its priority is reduced If a job gives up the CPU before the time slice is up, it stays at the same priority level

  6. Long-running job on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  7. Long-running job on MLFQ v1 Used entire time slice… Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  8. Long-running job on MLFQ v1 Q2 Used entire time slice… Q1 Q0 0 50 100 Time slice: 10 ms

  9. Long-running / Short-running jobs on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  10. Long-running / Short-running jobs on MLFQ v1 New job start from highest priority Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  11. Long-running / Short-running jobs on MLFQ v1 Used entire time slice… Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  12. Long-running / Short-running jobs on MLFQ v1 Job finished! Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  13. Long-running / Interactive jobs on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  14. Long-running / Interactive jobs on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  15. Long-running / Interactive jobs on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  16. Long-running / Interactive jobs on MLFQ v1 Q2 Q1 Q0 0 50 100 Time slice: 10 ms

  17. Problem of MLFQ v1: Starvation Q2 Q1 Q0 0 50 100 150 200 Long-running job could be starved by too many interactive jobs Time slice: 10 ms

  18. Problem of MLFQ v1: Starvation Q2 Q1 Q0 0 50 100 150 200 Long-running job could be starved by too many interactive jobs Time slice: 10 ms

  19. Problem of MLFQ v1: Starvation Q2 Q1 Q0 0 50 100 150 200 Long-running job could be starved by too many interactive jobs Time slice: 10 ms

  20. Problem of MLFQ v1: Starvation Q2 Q1 Q0 0 50 100 150 200 Long-running job could be starved by too many interactive jobs Time slice: 10 ms

  21. Problem of MLFQ v1: Starvation Q2 Q1 Q0 0 50 100 150 200 Long-running job could be starved by too many interactive jobs Time slice: 10 ms

  22. MLFQ v2: Boost Priority If Priority(A) > Priority(B), A runs If Priority(A) == Priority(B), A & B runs in Round-Robin When a job enters the system, it is placed at the highest priority If a job uses up an entire time slice while running, its priority is reduced If a job gives up the CPU before the time slice is up, it stays at the same priority level After some time period S, change priority of all the jobs in the system to the highest priority

  23. Long-running / Many interactive jobs on MLFQ v2 Q2 Q1 Q0 0 50 100 150 200 Time slice: 10 ms

  24. Long-running / Many interactive jobs on MLFQ v2 Priority boost! Q2 Q1 Q0 0 50 100 150 200 Time slice: 10 ms

  25. Long-running / Many interactive jobs on MLFQ v2 Q2 Q1 Q0 0 50 100 150 200 Time slice: 10 ms

  26. Long-running / Many interactive jobs on MLFQ v2 Priority boost! Q2 Q1 Q0 0 50 100 150 200 Time slice: 10 ms

  27. Problem of MLFQ v2: Gaming CPU Q2 Q1 Uses 9 msecs and gives back CPU :P Q0 0 50 100 150 200 A jobs could abuse scheduler by giving up CPU before time slice up Time slice: 10 ms

  28. MLFQ v3: Account CPU time If Priority(A) > Priority(B), A runs If Priority(A) == Priority(B), A & B runs in Round-Robin When a job enters the system, it is placed at the highest priority If a job uses up an entire time slice while running, its priority is reduced If a job gives up the CPU before the time slice is up, it stays at the same priority level Once a jobs uses up its time allotment at a given level, its priority is reduced After some time period S, change priority of all the jobs in the system to the highest priority

  29. Gaming tolerance on MLFQ v3 Q2 Q1 Q0 0 50 100 150 200 Time slice: 10 ms

  30. MLFQ Parameterization Problem • MLFQ should be parameterized well • Number of queues • Time slice • Priority boost period • Wrong configuration could cause wrong scheduling behavior

  31. MLFQ Parameterization Problem • MLFQ should be parameterized well • Number of queues • Time slice • Priority boost period • Wrong configuration could cause wrong scheduling behavior • General Solutions • Shorter time slice to higher priority queue • Provides configuration feature and default configuration • Uses mathematical formulae • Let user advice scheduler

  32. MLFQ Parameterization of Solaris, FreeBSD • Solaris • Make configurable and gives default configuration • Default configuration of Solaris MLFQ • 60 queues, 20 – few hundred milliseconds time slices, 1 second priority boost period

  33. MLFQ Parameterization of Solaris, FreeBSD • Solaris • Make configurable and gives default configuration • Default configuration of Solaris MLFQ • 60 queues, 20 – few hundred milliseconds time slices, 1 second priority boost period • FreeBSD • Uses mathematical formulae based on CPU usage • CPU usage is decayed for priority boost like effect

  34. Summary • MLFQ(Multiple Level Feedback Queue) Scheduler • Has multiple levels of queues • Uses feedback to determine the priority of a given job • Deliver excellent overall performance for short-running interactive jobs • Fair and makes progress for long-running CPU-intensive workloads

More Related