






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: Context Switching, Closed Book, Notes Examination, General Information, Unix Fork, Fork Operation, Child Process, Processes Maximizes, System Utilization, Cpu Scheduling
Typology: Exams
1 / 10
This page cannot be seen from the preview
Don't miss anything!







University of California, Berkeley College of Engineering Computer Science Division – EECS
Spring 2004 Anthony D. Joseph
March 18, 2004 CS162 Operating Systems
Your Name:
SID AND 162 Login:
TA:
Discussion Section:
General Information: This is a closed book and notes examination. You have 120 minutes to answer as many questions as possible. The number in parentheses at the beginning of each question indicates the number of points given to the question; there are 100 points in all. You should read all of the questions before starting the exam, as some of the questions are substantially more time consuming.
Write all of your answers directly on this paper. Make your answers as concise as possible. If there is something in a question that you believe is open to interpretation, then please ask us about it!
Problem Possible Score
TRUE FALSE Why?
ii) (4 points) Protection and isolation between applications and between applications and the operating system can be provided without hardware support.
TRUE FALSE Why?
iii) (4 points) After a UNIX fork operation, the parent and new child process are identical in all respects.
TRUE FALSE Why?
b. (5 points) Consider a system with a mixture of I/O bound processes and CPU bound processes i) (3 points) Explain how this mixture of processes maximizes system utilization:
ii) (2 points) Explain why this combination is more important in batch systems than it is on most computers sitting around in our department:
No Credit – Problem X (000000000000 points)
The following is an excerpt from The Washington Post's Style Invitational invitation to readers to: take any word from the dictionary, alter it by adding, subtracting, or changing one letter, and supply a new definition.
Here are this year's winners:
And the pick of the literature:
You are programming on a multiprocessor system using threads. The system includes monitors and condition variables, with the following classes and methods:
public class Monitor { public Monitor() { /* Creates a new monitor */ … }
public void Enter() { /* Enters the monitor */ … }
public void Exit() { /* Exits the monitor */ … } }
public class ConditionVariable { public ConditionVariable(Monitor mon) { /* Creates a condition variable associated with monitor mon / … } public void Wait() { / Blocks on the condition variable / … } public void Notify() { / Wakes up one thread waiting on cv, if there is such a thread / … } public void Broadcast() { / Wakes up all threads waiting on cv, if there are such threads */ … } }
Provide an implementation of general semaphores using this system. In other words, write the file Semaphore.java, implementing the following methods: public class Semaphore { public Semaphore(int initialValue) { /* Create and return a semaphore with initial value: initialValue/ … } public P() { / Call P() on the semaphore / … } public V() { / Call V() on the semaphore */ … } }
Write your solution on the following page.
A restaurant would like to serve four dinner parties, P1 through P4. The restaurant has a total of 8 plates and 12 bowls. Assume that each group of diners will stop eating and wait for the waiter to bring a requested item (plate or bowl) to the table when it is required. Assume that the diners don't mind waiting. The maximum request and current allocation tables are shown as follows:
Maximum Request
Plates Bowls
P1 7 7 P2 6 10 P3 1 2 P4 2 4
Current Allocation
Plates Bowls
P1 2 3 P2 3 5 P3 0 1 P4 1 2
a. (4 points) Determine the Need Matrix for plates and bowls. Need Plates Bowls P
P
P
P
b. (7 points) Will the restaurant be able to feed all four parties successfully? Clearly explain your answer – specifically, why no or why/how there is a safe serving order.
P
P
P
P
ii. (6 points) At least how many plates would the restaurant need to add?
iii. (3 points) Show a safe serving sequence.
This page intentionally left blank as scratch space.
Do not write answers on this page
Do not write answers on this page