第7章 进程调度:介绍

Homework:

        This program, scheduler.py, allows you to see how different schedulers perform under scheduling metrics such as response time, turnaround time, and total wait time. See the README for details.

Questions:

1. Compute the response time and turnaround time when running three jobs of length 200 with the SJF and FIFO schedulers. 

python scheduler.py -p FIFO -j 3 -s 100 -c

 

python scheduler.py -p SJF -l 200,200,200 -c 

 

2. Now do the same but with jobs of different lengths: 100, 200, and 300.

python scheduler.py -p FIFO -l 100,200,300 -c

 

python scheduler.py -p SJF -l 100,200,300 -c

 

 3. Now do the same, but also with the RR scheduler and a time-slice of 1.

python scheduler.py -p RR -l 100,200,300 -c

 

 4. For what types of workloads does SJF deliver the same turnaround times as FIFO?

长度短的工作先到,长度长的工作后到。
(如:工作负载分别为100,200,300)

5. For what types of workloads and quantum lengths does SJF deliver the same response times as RR?

工作负载的长度都特别短,最长不超过时间片的长度。
保证在第二个时间片来临时,只有最后一个工作负载没有完成。
(如:时间片为10,工作负载分别为:1,2,3,5)

6. What happens to response time with SJF as job lengths increase? Can you use the simulator to demonstrate the trend?

响应时间随着工作负载长度的增加而增加。但是RR就不会,即无论工作时长是多少,响应时间都不变
模拟程序如下:

python3 scheduler.py -p SJF -l 1,2,3 -c

 python3 scheduler.py -p SJF -l 10,20,30 -c

python3 scheduler.py -p SJF -l 100,200,300 -c 

7. What happens to response time with RR as quantum lengths in worst crease? Can you write an equation that gives the worst-case response time, given N jobs?

RR的响应时间随着时间片长度的增加而增加。
设时间片长度为m
响应时间=(0+1+2+...+(n-1))* m / N
              =m* (N+1) / 2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值