08.scheduling The Multi-Level Feedback Queue
08.scheduling The Multi-Level Feedback Queue
Finally let’s relax our final assumption - that the scheduler knows the
length of each job.
Objective:
Minimize response time for interactive jobs
Example:
A job repeatedly relinquishes the CPU while waiting IOs → Keep its priority
high
A job uses the CPU intensively for long periods of time → Reduce its
priority.
[High Priority] Q8 A B
Q7
Q6
Q5
Q4 C
Q3
Q2
[Low Priority] Q1 D
Rule 4a: If a job uses up an entire time slice while running, its priority is
reduced (i.e., it moves down on queue).
Rule 4b: If a job gives up the CPU before the time slice is up, it stays at
the same priority level
Q2
Q1
Q0
Preemption:
Job A: A long-running CPU-intensive job
A has been running for some time, and then B arrives at time T=100.
Q2 A:
Q1 B:
Q0
Assumption:
Job A: A long-running CPU-intensive job
Job B: An interactive job that need the CPU only for 1ms before
performing an I/O
Q2 A:
Q1 B:
Q0
Starvation
If there are “too many” interactive jobs in the system.
Rule 5: After some time period S, move all the jobs (haven’t been
scheduled) in the system to the topmost queue.
Example:
A long-running job(A) with two short-running interactive job(B, C)
A: B: C:
Solution:
Rule 4 (Rewrite Rules 4a and 4b): Once a job uses up its time allotment at
a given level (regardless of how many times it has given up the CPU), its
priority is reduced(i.e., it moves down on queue).
Q2 Q2
Q1 Q1
Q0 Q0
Q2
Q1
Q0
Rule 3: When a job enters the system, it is placed at the highest priority.
Rule 4: Once a job uses up its time allotment at a given level (regardless
of how many times it has given up the CPU), its priority is reduced(i.e., it
moves down on queue).
Rule 5: After some time period S, move all the jobs in the system to the
topmost queue.