



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this exam paper are: Mutual Exclusion, Multiprocess Program, Critical Section, Execution Sequence, Execution Sequence, Virtual Address, Ultimately Translated
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




NOTE: Please write your ID on every page of the exam.
Total
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.
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
the entries:
remove attributes from rows 1 and 2.
whether the copied attribute shall have the copy flag set or not. Example: domain 1 can copy ‘write’ to
(^) File 1.
, with or without the copy flag, if it has ‘owner’ access to
(^) File 2.
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
opinion? Give detailed reasons, because otherwise Alice and Bob won’t shut up.
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?