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  -  4  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.
ID 3
2. (10 pts) Virtual Memory. You are given a machine architecture whose hardware support for paged
virtual memory is limited to a TLB. No hardware translation based on page tables in memory is
supported. When a virtual address is submitted to the hardware, if there is a match in the TLB, a
successful virtual-to-physical address translation occurs. If there is no match, a fault occurs, causing
a trap to a VM address translation handler in the operating system which is provided the virtual
address. Describe (a) what this handler does, (b) what kind of data structure(s) it manages, and (c)
operationally, how the virtual address is ultimately translated.
ID 4
3. (10 pts) Protection.
Domain 1 Domain 2 Domain 3 File 1 File 2 Process 1
Domain 1 *owner *owner *call *owner
control control *read
Domain 2 call *read write wakeup
Domain 3 owner read *owner
Figure 1: Portion of an access matrix (‘*’ denotes that copy flag is set)
Recall that in Lampson’s Protection, is the access control matrix and an entry is the set of
access permissions domain d has on object . He further defines the following rules for manipulation
the entries:
(a) can remove access attributes from if it has ‘control’ access to . Example: domain 1 can
remove attributes from rows 1 and 2.
(b) can copy to any access attributes it has for which has the copy flag set, and can say
whether the copied attribute shall have the copy flag set or not. Example: domain 1 can copy ‘write’
to File 1.
(b) may add any access attribute to , with or without the copy flag, if it has ‘owner’ access to
. Example: domain 2 can add ‘write’ to File 2.
Your company is building an application where an application has to give access to an object to a
second program that is untrusted and may be potentially malicious, where only that second program
should have access and no others. The operating system your application is hosted upon directly
implements Lampson’s protection mechanism. Your colleague Bob claims that the way the copy flag
works completely prevents a subdomain with access to from inappropriately giving away access to
to some other domain. Alice claims that he is wrong, and they have a $10 bet on this. What is your
opinion? Give detailed reasons, because otherwise Alice and Bob won’t shut up.
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: 1192
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