第9章 调度:比例份额

Homework

        This program, lottery.py, allows you to see how a lottery scheduler works. See the README for details.

questions:

1. Compute the solutions for simulations with 3 jobs and random seeds of 1, 2, and 3.

python lottery.py -j 3 -s 1 -c

 python lottery.py -j 3 -s 2 -c

python lottery.py -j 3 -s 3 -c 

2. Now run with two specific jobs: each of length 10, but one (job 0) with just 1 ticket and the other (job 1) with 100 (e.g., -l 10:1,10:100). What happens when the number of tickets is so imbalanced? Will job 0 ever run before job 1 completes? How often? In general, what does such a ticket imbalance do to the behavior of lottery scheduling?  

 job1完成之前,job0基本上是没有机会运行的

这种彩票不平衡会使这两个job像在队列中一样,前面的job不运行完,后面的job基本就没机会运行

python lottery.py -j 2 -l 10:1,10:100 -c

3. When running with two jobs of length 100 and equal ticket allocations of 100 (-l 100:100,100:100), how unfair is the scheduler? Run with some different random seeds to determine the (probabilistic) answer; let unfairness be determined by how much earlier one job finishes than the other.

seed = 1

U = 196 / 200 = 0.98

python lottery.py -j 2 -l 100:100,100:100 -s 1 -c

seed = 2

U = 190 / 200 = 0.95

python lottery.py -j 2 -l 100:100,100:100 -s 2 -c

seed = 3

U = 196 / 200 = 0.98

python lottery.py -j 2 -l 100:100,100:100 -s 3 -c

seed = 4

U = 199 / 200 = 0.995

 python lottery.py -j 2 -l 100:100,100:100 -s 4 -c

4. How does your answer to the previous question change as the quantum size (-q) gets larger?

q = 5

U = 190 / 200 = 0.95

python lottery.py -j 2 -l 100:100,100:100 -s 1 -q 5 -c

q = 10

U = 160 / 200 = 0.8

python lottery.py -j 2 -l 100:100,100:100 -s 1 -q 10 -c

q = 50

U = 150 / 200 = 0.75

python lottery.py -j 2 -l 100:100,100:100 -s 1 -q 50 -c

随着时间片长度的增加,抽取彩票的次数将减少,每次中奖的进程运行的时间将增加

因此会越来越不公平

5. Can you make a version of the graph that is found in the chapter? What else would be worth exploring? How would the graph look with a stride scheduler?

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值