Exam Information
Login / Sign Up to View Document
Sample Document Text
CS 471: Operating Systems
In-Class Exam 2
Name:________________________
April 20 2006
Instructions: This exam is open book, open notes. The work you turn in must be your own. To receive credit
you must sign the honor pledge at the end of the exam.
1. (10 pts) Consider the bakery algorithm for critical sections. n processes have the shared data:
boolean choosing[n];
int number[n];
which are initialized to false and 0 respectively. Each process has a unique number, i, each executes the
following code:
do {
choosing[ i ] = true;
number[ i ] = max( number[0], number[1], ., number[n - 1] ) + 1;
choosing[ i ] = false;
for ( j = 0; j < n; j++ ) {
while ( choosing[ j ] ) ;
while ( (number[ j ] != 0 ) &&
( ( number[ j ], j ) < ( number[ i ], i ) ) ;
}
critical section
number[ i ] = 0;
remainder section
} while ( 1 );
Why must the second while loop check both the number array and the values of i and j? Hint: Part of you
answer should explain why two processe...
Related Documents
Associative Memory Exam
Associative Memory Exam
Associative Memory Exam
Associative Memory Exam
Instructions Exam
Instructions Exam
Internal Fragmentation Notes
Memory References Exam
Memory References Exam
Internal Fragmentation Notes
Directories Exam
Directories Exam
Performance Exam
Positive Value Exam
Positive Value Exam
Particularly Exam
© Copyright 2019 , Koofers, Inc. All rights reserved.
The information provided on this site is protected by U.S. and International copyright law, and other applicable intellectual property laws, including laws covering data access and data compilations. This information is provided exclusively for the personal and academic use of students, instructors and other university personnel. Use of this information for any commercial purpose, or by any commercial entity, is expressly prohibited. This information may not, under any circumstances, be copied, modified, reused, or incorporated into any derivative works or compilations, without the prior written approval of Koofers, Inc.