OP SYS HW3.docx - Operating Systems HW3 1 a Two processes can NOT be in the in their critical regions at the same time b Can NOT assume execution speed

OP SYS HW3.docx - Operating Systems HW3 1 a Two processes...

This preview shows page 1 - 2 out of 2 pages.

Operating Systems: HW3 1.) a. Two processes can NOT be in the in their critical regions at the same time b. Can NOT assume execution speed, or the number of CPUs will prevent race conditions c. A process running outside the critical region can NOT block other processes d. A process should NOT wait forever to ender its critical region 2.) a. First Come First Server P1 P2 P3 P4 P5 0 10 11 13 14 19 Shortest Job First P2 P4 P3 P5 P1 0 1 2 4 9 19 Non-Preemptive Priority P4 P1 P3 P5 P2 0 1 11 13 18 19 Round Robin P1 P2 P3 P4 P5 P1 P3 P5 P1 P5 P1 P5 P1 P5 P1 P1 P1 P1 P1 01 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 b. FCFS P1 = 10-0 = 10 P2 = 11-0 = 11 P3 = 13-0 = 13 P4 = 14-0 = 14 P5 = 19-0 = 19 SJF P2 = 1-0 = 1 P4 = 2-0 = 2 P3 = 4-0 = 4 P5 = 9-0 = 9 P1 = 19-0 = 19 NPP P4 = 1-0 = 1 P1 = 11-0 = 11 P3 = 13-0 = 13 P5 = 18-0 = 18 P2 = 19-0 = 19 RR P1 = 19-0 = 19 P2 = 2-0 = 2 P3 = 7-0 = 7 P4 = 4-0 = 4 P5 = 14-0 = 14 c. FCFS P1 = 10-10 = 0 P2 = 11-1 = 10 P3 = 13-2 = 11 P4 = 14-1 = 13 P5 = 19-5 = 14 SJF P1 = 19-10 = 9 P2 = 1-1 = 0 P3 = 4-2 = 2 P4 = 2-1 = 1 P5 = 9-5 = 4
Image of page 1
NPP P1 = 11-10 =
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

Unformatted text preview: 1 P2 = 19-1 = 18 P3 = 13-2 = 11 P4 = 1-1 = P5 = 18-5 = 13 RR P1 = 19-10 = 9 P2 = 2-1 = 1 P3 = 7-2 = 5 P4 = 4-1 = 3 P5 = 14-5 = 9 d. FCFS Ave. waiting time = (0+10+11+13+14)/5 = 48/5 = 9.6ms SJF Ave. waiting time = (9+0+2+1+4)/5 = 16/5 = 3.2ms NPP Ave. waiting time = (1+18+11+0+13)/5 = 43/5 = 8.6ms RR Ave. waiting time = (9+1+5+3+9)/5 = 27/5 = 5.4ms SJF HAS THE MINIMAL AVERAGE WAITING TIME 3.) I/O based programs are favored because they use the CPU for a relatively short amount of time and CPU bound programs will not starve because I/O programs give up use of the CPU relatively often. 4.) Because spinlocks use up CPU resources which may be needed to resolve the situation the spinlock is waiting for. On a multiprocessor machine there are more CPUs available to do work while one CPU’s resources are being held for the spinlock....
View Full Document

  • Fall '13
  • Franco

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors