[OSTEP Chapter 8] Scheduling: The Multi-Level Feedback Queue

MLFQ 基本规则:

  1. Rule 1: If priority(A) > Priority(B), A runs (B doesn’t)
  2. Rule 2: If Priority(A) = priority(B),A & B run in RR
  3. rule 3: when a job enters the system , it is placed at the highest priority (the topmost queue)
  4. rule 4a: if a job uses up an entire time slice while running , its priority is reduced (i.e.,it moves down one queue).
  5. rule 4b: if a job gives up the CPU before the time slice is up, it stays at the same priority level

问题:

  1. 如果有很多敏感jobs,需要长时间运行的jobs 可能会一直得不到CPU资源
  2. 有些程序会作弊得到更多资源,比如在slice time 结束之前触发一个I/O 操作
  3. 一个程序可能会随时改变行为模式

解决问题的方案 (problem 1,3):

Rule 5: After some time period S, move all the jobs in the system to the topmost queue

解决程序作弊的方案 ( problem 2 增强版的Rule 4):

Rule 4 : Once a job uses up its time allotment at a given level (re-gardless of how many times it has given up the CPU), its priority is reduced (i.e., it moves down one queue).

Published by

Leave a Reply

Your email address will not be published. Required fields are marked *