One cpu bound job many io bound cpu bound runs io

Info icon This preview shows pages 20–23. Sign up to view the full content.

View Full Document Right Arrow Icon
One CPU bound job, many I/O bound CPU bound runs I/O jobs blocked in ready queue I/O devices idle CPU bound blocks I/O bound job(s) run, quickly block on I/O CPU bound runs again I/O of the I/O bound jobs completes CPU bound still runs while I/O devices idle (continues…)
Image of page 20

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
21 Round robin (RR) Round robin (RR) Solution to job monopolizing CPU? Interrupt it. Run job for some “time slice,” When time is up, or it blocks It moves to back of a FIFO queue Advantage: Fair allocation of CPU across jobs Low average waiting time when job lengths vary 1 2 3 4 5 103 CPU time A B C A C A What is avg completion time? = (103 + 2 + 5) / 3
Image of page 21
22 Round Robin’s Disadvantage Round Robin’s Disadvantage Good for Varying sized jobs But what about same-sized jobs? Assume 2 jobs of time =100 each: time 1 2 3 4 5 199 200 CPU A B A B A B A B A Avg completion time? (200 + 200) / 2 = 200 How does this compare with FCFS for same two jobs? (100 + 200) / 2 = 150
Image of page 22

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
23 RR Time slice tradeoffs RR Time slice tradeoffs Performance depends on length of the timeslice Context switching isn’t a free operation. If timeslice time is set too high (attempting to amortize context switch cost) You get FCFS. i.e. Processes will finish or block before their slice is up anyway If it’s set too low you’re spending all of your time context switching between threads.
Image of page 23
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern