循环调度:两种不同的解决方案-怎么可能? [英] Round Robin Scheduling : Two different solutions - How is that possible?

查看:99
本文介绍了循环调度:两种不同的解决方案-怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

五个批处理作业A到E,几乎同时到达计算机中心.他们估计运行时间为10、6、2、4和8分钟.它们(外部确定的)优先级分别为3、5、2、1和4,其中5为最高优先级.确定平均过程周转时间.忽略进程切换开销.对于Round Robin Scheduling,假定系统是多程序的,并且每个作业都能公平分配CPU.所有作业都完全受CPU限制.

解决方案#1 以下解决方案来自

对于循环赛,在前10分钟内,每个工作获得1/5的 中央处理器.在10分钟结束时,C完成.在接下来的8年中 分钟后,每个作业将获得CPU的1/4,之后时间D结束. 然后,剩下的三个作业中的每一个都会获得6的CPU的1/3 分钟,直到B完成,依此类推.五个的完成时间 工作是10、18、24、28、30,平均22分钟.

For round robin, during the first 10 minutes, each job gets 1/5 of the CPU. At the end of the 10 minutes, C finishes. During the next 8 minutes, each job gets 1/4 of the CPU, after which time D finishes. Then each of the three remaining jobs get 1/3 of the CPU for 6 minutes, until B finishes and so on. The finishing times for the five jobs are 10, 18, 24. 28, 30, for an average of 22 minutes.

解决方案#2 以下解决方案来自康奈尔大学,可以找到

Solution #2 the following solution comes from Cornell University, can be found here, and is obviously different from the previous one even though the problem is given in exactly the same form (this solution, by the way, makes more sense to me) :

请记住,周转时间是指经过的时间 在到达工作和完成工作之间.由于我们假设 所有作业都在时间0到达,周转时间就是时间 他们完成. (a)循环赛:下表为休息时间 在每个时间范围内将处理哪些作业.一种 * 表示工作在该时间段内完成.

Remember that the turnaround time is the amount of time that elapses between the job arriving and the job completing. Since we assume that all jobs arrive at time 0, the turnaround time will simply be the time that they complete. (a) Round Robin: The table below gives a break down of which jobs will be processed during each time quantum. A * indicates that the job completes during that quantum.

1 2 3 4 5  6 7 8  9 10  11 12 13 14  15 16 17 18  19 20 21  22 23 24  25 26  27 28  29 30  
A B C D E  A B C* D E   A  B  D  E   A  B  D* E   A  B  E   A  B* E   A  E   A  E*  A  A*

结果不同:例如,第一个C在10分钟后完成,而第二个C在8分钟后完成.

The results are different: In the first one C finishes after 10 minutes, for example, whereas in the second one C finishes after 8 minutes.

哪个是正确的,为什么?我很困惑..预先感谢!

Which one is the correct one and why? I'm confused.. Thanks in advance!

推荐答案

问题有所不同.第一个问题没有指定时间范围,因此您必须假设该范围与一分钟相比非常小.第二个问题明确指定了一个一分钟的调度程序范围.

The problems are different. The first problem does not specify a time quantum, so you have to assume the quantum is very small compared to a minute. The second problem clearly specifies a one minute scheduler quantum.

第二个解决方案的奥秘在于为什么它假定任务以字母顺序运行.我只能假设这是整个课程中所做的假设,因此希望学生在这里知道如何做到这一点.

The mystery with the second solution is why it assumes the tasks run in letter order. I can only assume that this an assumption made throughout the course and so students would be expected to know to make it here.

这篇关于循环调度:两种不同的解决方案-怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆