简体   繁体   中英

calculating round robin and fcfs job time

Why does fcfs go from 0 99 , and from 99 to 198

And for Round robin, I don't understand why the first job completion time is 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. 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.

For round robin, each job runs for 1 second and gets context switched out. 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. In this way there is one execution of job 1 in 5 cycles. Since proc 1 requires 100 seconds in total it would finish at 500 seconds.

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)). 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. In this way its 100th and final execution will be at t=500.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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