



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
Material Type: Exam; Class: Operating Systems; Subject: Computer Science and Engineering; University: Arizona State University - Tempe; Term: Spring 2006;
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Put Name on Every Page
1. (15 + 3 points extra credit) Demand Paged Memory Management Given the following sequence of page references from a program: 2, 3, 2, 1, 5, 2, 4, 5, 3, 2 and assuming 100 word pages and that 300 words of primary memory are available to the program, find the number of page faults using each of the three page replacement algorithms indicated below. Note: To obtain partial credit on these parts you must show how you got your answers. (a) (5) LRU (b) (5) Optimal (c) (5) Clock (d) (3 points extra credit) Explain why Optimal does not suffer from Belady’s anomaly. Note: Saying that it is a stack algorithm gets you zero points. You need to show how it comes about that if you increase the number of frames the thing that happens in Belady’s anomaly can’t occur.
(3:15 Class)
Put name on EVERY page
2. (10) Synchronization Hardware Boolean lock; while (true) { while ( TestAndSet (&lock )) ; /* do nothing // critical section lock = FALSE; // remainder section } Shown above are two ways the TestAndSet hardware instruction can be used to insure mutual exclusion. (a) (3)What advantage does the solution on the right have over the solution on the left? (b) (3) Show that the solution on the right meets the mutual exclusion requirement for the solution to the critical section problem. (c) (4) Show that the solution on the right meets the bounded waiting requirement for the critical section problem. Include in your answer what the upper bound on the waiting time for a process that wants to enter the critical section is. Boolean waiting[n]; Boolean lock; do { waiting[i] = TRUE; key = TRUE; while (waiting[i] && key) key = TestAndSet(&lock); waiting[i] = FALSE; // critical section j = (i+1) %n; while ((j != i) && !waiting[j]) j = (j + 1) %n; if (j == i) lock = FALSE; else waiting[j] = FALSE; // remainder section } while (TRUE);
(3:15 Class)
Put name on EVERY page
4. (25) Deadlock (a) (10) For each of the two systems whose resource allocation state is shown by the graphs below, state whether the system is in deadlock or not. If the system is in deadlock state what it is about the figure that indicates this and if the system is not in deadlock give a possible completion sequence for the processes. (b) (10) Name the 4 necessary conditions for deadlock to hold. (c) (5) For one of the necessary conditions you named in (b) above, say why it’s impracticable to prevent deadlock by preventing this condition from holding.
(3:15 Class)
Put name on EVERY page
5. (12) Handheld Systems Name three characteristics of Handheld Systems that place constraints on the design of operating systems for them. For two of these characteristics state what operating system designers must do to accommodate them. 6. (10) System Design and Implementation. What is meant by designing operating system modules in such a way that policy and mechanism are separated? Why is it important? Give an example.