简体   繁体   English

计算循环和fcfs的工作时间

[英]calculating round robin and fcfs job time

Why does fcfs go from 0 99 , and from 99 to 198 为什么fcfs从0 99和99变为198

And for Round robin, I don't understand why the first job completion time is 500. 而对于循环赛,我不明白为什么第一工作完成时间是500。

An explanation and example would help, thanks 一个解释和例子会有所帮助,谢谢 在此处输入图片说明

Wait time for job 1 is 0 under FCFS because it gets scheduled immediately as it is the only job at time t = 0. Job 2 comes at t=1 but is scheduled after job 1 finishes at time t=100 ,meaning a wait of 99 seconds(t=1 to t=100) till it gets scheduled. 在FCFS下,作业1的等待时间为0,因为它是立即调度的,因为它是时间t = 0的唯一作业。作业2在t = 1到达,但在作业1在时间t = 100完成之后才调度,这意味着等待99秒(t = 1到t = 100)直到被调度。 Similarly job 3 comes at t=2 and gets scheduled only after jobs 1 and 2 finish ie at t=200, meaning a wait of 200-2 = 198 seconds. 同样,作业3在t = 2到达,并且仅在作业1和2完成后即t = 200时才被调度,这意味着等待200-2 = 198秒。

For round robin, each job runs for 1 second and gets context switched out. 对于循环,每个作业运行1秒钟,并切换上下文。 This happens in an orderly way. 这有序地发生。 So after job 1 runs from t=0 to t=1, job 2 runs from t=1 to 2, job 3 from t=2 to 3 and so on till 1 runs back again from t=5 to t=6. 因此,在作业1从t = 0运行到t = 1之后,作业2从t = 1运行到2,作业3从t = 2运行到3,依此类推,直到1从t = 5再次运行到t = 6。 In this way there is one execution of job 1 in 5 cycles. 这样,将在5个周期中执行一次作业1。 Since proc 1 requires 100 seconds in total it would finish at 500 seconds. 由于过程1总共需要100秒,因此它将在500秒后完成。

Do upvote if you will this explanation helpful. 如果您对本说明有帮助,请进行投票。

edit: 编辑:

Round Robin in detail: 循环赛详细信息:

Job 1 runs for total 100 seconds in chunks of 1 seconds each separated by interval of 4 seconds(1(chunk for job 2)+1(job 3)+1(job 4)+1(job 5)). 作业1以1秒的块为单位运行总计100秒,每个块之间间隔4秒(1(作业2的块)+1(作业3)+1(作业4)+1(作业5))。 So it runs at t=0, t=5, t=10... each time for just 1 second interleaved by similar 1 second executions of jobs 2,3,4,5. 因此,它在t = 0,t = 5,t = 10 ...每次仅运行1秒,与作业2、3、4、5的类似1秒执行时间交错时运行。 In this way its 100th and final execution will be at t=500. 这样,它的第100次和最终执行将在t = 500。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM