Mutual Exclusion - Operating System - Exam, Exams of Operating Systems

Main points of this exam paper are: Mutual Exclusion, Multiprocess Program, Critical Section, Execution Sequence, Execution Sequence, Virtual Address, Ultimately Translated

Typology: Exams

2012/2013

Uploaded on 04/07/2013

seshan_kim55
seshan_kim55 🇮🇳

4.7

(3)

54 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Operating Systems Comprehensive Examination
Spring Quarter, 2002
ID
NOTE: Please write your ID on every page of the exam.
1
2
3
4
5
Total
1
pf3
pf4
pf5

Partial preview of the text

Download Mutual Exclusion - Operating System - Exam and more Exams Operating Systems in PDF only on Docsity!

Operating Systems Comprehensive Examination

Spring Quarter, 2002

ID

NOTE: Please write your ID on every page of the exam.

Total

  1. (10 pts) Synchronization.

Consider Peterson’s algorithm for mutual exclusion, given below:

int in0 = 0, in1 = 0, turn; cobegin 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; } coend

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

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

  1. (10 pts) Protection.

Domain 1 Domain 2 Domain 3 File 1 File 2 Process 1 Domain 1 *owner *owner *call *owner control control *read *write Domain 2 call *read write wakeup Domain 3 owner read *owner control

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.

  1. (10 pts) Page Replacement. Consider the following virtual memory page replacement string:

1, 2, 3, 1, 4, 5, 1, 5, 2, 6, 4, 5 Assume that there are four page frames in physical memory, and that they are initially empty.

(a) What is the sequence of page faults that occur if FIFO replacement is used? (b) What is the sequence of page faults that occur if LRU replacement is used? (c) What is the sequence of page faults that occur if MRU replacement is used? (d) What is an optimal sequence of evictions that results in the minimum number of page faults?