hw5sol-partial - HOMEWORK 5 SOLUTION - Oct 30, 2008...

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

View Full Document Right Arrow Icon
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)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/13/2009.

Page1 / 2

hw5sol-partial - HOMEWORK 5 SOLUTION - Oct 30, 2008...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online