Mutual Exclusion - Operating System - Exam, Exams for Operating System. Bengal Engineering & Science University

Operating System

Description: Main points of this exam paper are: Mutual Exclusion, Multiprocess Program, Critical Section, Execution Sequence, Execution Sequence, Virtual Address, Ultimately Translated
Showing pages  1  -  2  of  6
Operating Systems Comprehensive Examination
Spring Quarter, 2002
NOTE: Please write your ID on every page of the exam.
ID 2
1. (10 pts) Synchronization.
Consider Peterson’s algorithm for mutual exclusion, given below:
int in0 = 0, in1 = 0, turn;
while (1) {
in0 = 1;
turn = 1;
while (in1 && turn == 1) ;
critical section
in0 = 0;
while (1) {
in1 = 1;
turn = 0;
while (in0 && turn == 0) ;
critical section;
in1 = 0;
Suppose the critical section code for each process is a short operation, such as an increment instruc-
tion. If you were to run this multiprocess program on operating systems (such as Unix) that use a time
sliced round robin scheduler, you would find that initially the rate that the processes enter their critical
sections would be fast, but after some time elapsed their rate would suddenly become dramatically
(a) Explain this behavior by giving an execution sequence that results in the slower rate of entrance
into critical sections.
(b) How could you predict the amount by which the rate would be decreased?
(c) Can you think of a way to fix the problem so that the rate the processes enter the critical sections
remain fast no matter what their execution sequence is? Be as creative as you need to be, but do
not spend too much time on this part of the question; if no idea immediately occurs to you, say
so and move on.
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Uploaded by: seshan_kim55
Views: 1286
Downloads : 0
University: Bengal Engineering & Science University
Upload date: 07/04/2013
Embed this document:
Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome