我们什么时候更喜欢循环而不是 FCFS,反之亦然?
我知道这取决于设计,但有人问我这个问题,但没有采取任何假设。 我应该回答什么以及
i know this depends on the design, but i was asked this question and no assumptions taken..
what should i answer and
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,这听起来很像一个家庭作业问题。如果是这样的话,我建议您自己研究一下。
我认为 FCFS 的意思是“先到先服务”,如果我记得这是一个按照提供给调度程序的顺序执行进程直至完成的系统,是吗?
如果是这样,基本准则是:如果希望允许长时间运行的进程执行,同时不干扰较短的进程,则使用循环法,但副作用是无法保证完成顺序。如果系统中有许多进程,循环可能会受到影响,因为由于往返时间较长,每个进程需要更长的时间才能完成。
如果您确实需要有保证的完成顺序,FCFS 是更好的选择,但长时间运行的进程可能会导致系统停顿。然而,每个过程都得到系统的充分关注,并且可以在尽可能快的时间内完成,因此这是一个好处。
最后,它确实归结为不一定是设计,而是需要:我需要半同步执行还是需要按顺序执行?流程花费更长的时间但同步计算对我有利吗?或者如果一切都尽可能快地执行,我会更好吗?系统的需求决定了要使用的模型。
编辑:维基百科对这些和其他简单的调度方法有很好的细分这里
First off, this sounds suspiciously like a homework question. If that's the case, I recommend researching on your own.
By FCFS I assume you mean "First Come First Serve", and if I recall that's a system where processes are executed to completion in the order that they are provided to the scheduler, yes?
If so the basic guideline would be this: Use round robin if it is desirable to allow long running processes to execute while not interfering with shorter ones, with the side effect that order of completion is not guaranteed. Round Robin can suffer if there are many processes in the system, since it will take longer for each process to complete since the round trip is longer.
If you do need a guaranteed order of completion, FCFS is a better choice but long running processes can stall the system. However, each process is given the full attention of the system and can complete in the fastest possible time, so that can be a benefit.
In the end it really does come down to not necessarily design but need: Do I need semi-synchronous execution or do I need in-order execution? Is it to my benefit for processes to take longer but compute in sync or will I be better off if everything executes as fast as possible? The needs of the system dictate the model to use.
Edit: Wikipedia has a pretty good breakdown of these and other simple scheduling methods here