8. Multi-level Feedback

0. 文件地址

Homework

1. MLFQ: Basic Rules

在这里插入图片描述
在这里插入图片描述

2. Attempt #1: How To Change Priority

在这里插入图片描述

2.1 Example 1: A Single Long-Running Job

在这里插入图片描述

2.2 Example 2: Along Came A Short Job

In this example, there are two jobs: A, which is a long-running CPU-intensive job, and B, which is a short-running interactive job. Assume A has been running for some time, and then B arrives. What will happen? Will MLFQ approximate SJF for B?
在这里插入图片描述
A (shown in black) is running along in the lowest-priority queue (as would any long-running CPU intensive jobs); B (shown in gray) arrives at time T = 100, and thus is inserted into the highest queue; as its run-time is short (only 20 ms), B completes before reaching the bottom queue, in two time slices; then A resumes running (at low priority).

2.3 Example 3: What About I/O?

在这里插入图片描述
在这里插入图片描述

2.4 Problems With Our Current MLFQ

  1. starvation: if there are “too many” interactive jobs in the system, they will combine to consume all CPU time, and thus long-running jobs will never receive any CPU time (they starve).
  2. game the scheduler: Gaming the scheduler generally refers to the idea of doing something sneaky to trick the scheduler into giving you more than your fair share of the resource.
  3. a program may change its behavior over time: what was CPU-bound may transition to a phase of interactivity.

3. Attempt #2: The Priority Boost

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

4. Attempt #3: Better Accounting

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5. Tuning MLFQ And Other Issues

在这里插入图片描述
在这里插入图片描述

6. Summary

在这里插入图片描述

7. Homework (Simulation)

在这里插入图片描述

Question & Answer

在这里插入图片描述

1. Run a few randomly-generated problems with just two jobs and two queues; compute the MLFQ execution trace for each. Make your life easier by limiting the length of each job and turning off I/Os.

在这里插入图片描述
在这里插入图片描述

2. How would you run the scheduler to reproduce each of the examples in the chapter?

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3. How would you configure the scheduler parameters to behave just like a round-robin scheduler?

in order to reflect RR scheduling, this parameter should have the following points:
1. Multiple jobs
2. One queue
3. There are the time slice

// x >= 2,y > 0
python mlfq.py -n 1 -j x -q y
4. Craft a workload with two jobs and scheduler parameters so that one job takes advantage of the older Rules 4a and 4b (turned on with the -S flag) to game the scheduler and obtain 99% of the CPU over a particular time interval.

to be continue…

5. Given a system with a quantum length of 10 ms in its highest queue, how often would you have to boost jobs back to the highest priority level (with the -B flag) in order to guarantee that a single long running (and potentially-starving) job gets at least 5% of the CPU?
T(boost) <= T(time slice) / 0.05 = 10ms / 0.05 = 200ms
6. One question that arises in scheduling is which end of a queue to add a job that just finished I/O; the -I flag changes this behavior for this scheduling simulator. Play around with some workloads and see if you can see the effect of this flag.

to be continue…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值