{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw5sol-partial

# hw5sol-partial - HOMEWORK 5 SOLUTION(Version 1 Total Points...

This preview shows pages 1–2. Sign up to view the full content.

HOMEWORK 5 SOLUTION ------------------- Oct 30, 2008 (Version 1) Total Points = 14 = 2 + 6 + 6 Problem 1 (2 Points) --------- (TO COME) Problem 2 (0 Points) --------- a) The test 'turn == other' places a FIFO ordering on entry into the critical section. Without loss in generality, suppose process 0 is in the critical section while process 1 is busy waiting. If process 0 leaves the critical section, it does so by turning off flag[0]. If process 0 attempts to reenter the critical section before process 1 gets to evaluate the conditional of the while statement, it will have set turn equal to other and busy wait. Meanwhile, as soon as process 1 evaluates the conditional part of the while, it will enter the critical section because process 0's execution of the 'turn = other' statement will release process 1. Thus, one process can not monopolize the critical section; i.e., it can not get ahead of the other process if it is also trying to enter the critical section. b) Since there is no mutual waiting from the explanation in Part a, there can not be any deadlock.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern