

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: Safe Sequence, Realizable Algorithms, Scheduling Algorithm, Safe Sequence, Complete Safe, Page Table, Table Entry, Semaphores, Process Synchronization, Synchronization Mechanisms
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CS 162 Fall 2002 Professor Alan Jay Smith Midterm 1
Problem 1: Assume that the job run time distribution in a system is as follows:
run time 8 9 10 11 12
probability . . . . .
Consider the following scheduling algorithms: round robin (Q=1), FCFS, SRPT, SET.
a. Predict the relative performance of these four algorithms for a system with the job run time distribution given above. Explain (and justify) your answer. (7)
b. Considering only the realizable algorithms among those listed above, either prove that one of the above realizable algorithms is optimal (among realizable algorithms) for this system, or design a new realizable scheduling algorithm for jobs in this system that outperforms all of the realizable algorithms considered in part (a), and justify (show/prove/argue convincingly) why it is better. (7)
c. Assume now that your system has two stages. In the first stage, each job is processed for some amount of time X(i) (X(i) Problem 2: For the following two cases, please either show a complete safe sequence or prove that there isn't one (12)
Process A B C D
has-X 30 50 30 0
has-Y 10 80 20 70
max-needs-X 60 100 105 50
max-needs-Y 40 220 50 90
(a) available: X: 40 Y: 40 (b) available: X: 40 Y: 35
Problem 3 Interrupts, Traps, Exceptions:
a. What are traps? Give at least 2 examples and explain why they are traps. Why are traps necessary? (6)
b. What are interrupts? Give at least 2 examples and explain why they are interrupts. Why are interrupts useful? (6)
c. What are exceptions? (3)
Problem 4:
CS162 Fall 2002 Midterm 1
What are the tradeoffs between semaphores and monitors as process synchronization mechanisms? (15)
Problem 5: We defined "test and set" and "swap" instructions as mechanisms to help implement synchronization. Define each, and show how each can be used to implement a critical section. Why is "test and set" preferred to "swap?" (12)
Problem 6: One of the conditions for deadlock is a circuit in the resource request graph. Explain: (a) What the resource request graph is. (b) How this condition implies the other conditions for deadlock. (And be sure to tell us what those other conditions are.) (c) Therefore why this condition is necessary and sufficient for deadlock. (15)
Problem 7: What are all of the fields in a page table entry? What is each used for (except for the one that we didn't discuss in class)? (10)
CS162 Fall 2002 Midterm 1