Docsity

CSE 430 Midterm 2: CPU Scheduling, Sync Problems, Monitors, Atomic Transactions, Exams of Operating Systems

Toggle sidebar
bg1
CSE 430
FALL 2007 MIDTERM 2
(6:40 CLASS)
NAME
Put Name on Every Page
1. (30) Scheduling
Given the following jobs:
Job # Arrival Time Run Time
A 0 3
B 2 6
C 4 4
D 6 5
E 8 2
(a) (18) Draw a Gantt chart to illustrate the execution of these jobs for each of the
following 3 CPU scheduling algorithms: Shortest Remaining Time First; Round
Robin with q=4; and Shortest Job First. Make the following assumptions to handle
'ties.' In Shortest Remaining Time First, if two jobs have the same shortest remaining
time, the one that arrived first gets to go. Helpful Hint: Take your time. Be careful on
SRTF and RR.
(b) (6) What is the average waiting time for Round Robin with Q=4?
(c) (3) What bound does context switch time place on the quantum for Round Robin process
scheduling and why is this so?
(d) (3) Why is it essentially impossible to implement Shortest Remaining Time First?
pf3
pf4

Partial preview of the text

Download CSE 430 Midterm 2: CPU Scheduling, Sync Problems, Monitors, Atomic Transactions and more Exams Operating Systems in PDF only on Docsity!

CSE 430

FALL 2007

MIDTERM 2

(6:40 CLASS)

NAME

Put Name on Every Page

1. (30) Scheduling Given the following jobs: Job # Arrival Time Run Time A 0 3 B 2 6 C 4 4 D 6 5 E 8 2 (a) (18) Draw a Gantt chart to illustrate the execution of these jobs for each of the following 3 CPU scheduling algorithms: Shortest Remaining Time First; Round Robin with q=4; and Shortest Job First. Make the following assumptions to handle 'ties.' In Shortest Remaining Time First, if two jobs have the same shortest remaining time, the one that arrived first gets to go. Helpful Hint : Take your time. Be careful on SRTF and RR. (b) (6) What is the average waiting time for Round Robin with Q=4? (c) (3) What bound does context switch time place on the quantum for Round Robin process scheduling and why is this so? (d) (3) Why is it essentially impossible to implement Shortest Remaining Time First?

CSE 430

SPRING 2007

MIDTERM 2

(6:40 CLASS)

NAME

Put Name on Every Page

2. (28) Classical Synchronization Problems For this question use the Addendum to MT2 which contains four solutions to the dining philosophers problem. (a) (5) Which solution can fail because of deadlock? Why? (b) (5) Of the remaining solutions, assuming entries in semaphore queues are processed FCFS, which solution can lead to starvation? Why? (c) (10) Solutions to synchronization problems exhibit a concurrency vs. fairness tradeoff. Compare solutions 2 and 4 in this respect. Note: You need to state what concurrency is allowed by each solution and what limitation on fairness occurs in each solution. (d) (5) In solution 4 the mutex semaphore provides mutually exclusive access by allowing only one process at a time to execute critical sections of code? What is the shared data area that the critical sections of code access? (e) (3) Compare solutions 3 and 4 with respect to concurrency and fairness. As in part (c), you need to state what concurrency is allowed by each solution and what limitation on fairness occurs in each solution. You must include an example of when the allowed concurrency is different.

CSE 430

SPRING 2007

MIDTERM 2

(6:40 CLASS)

NAME

Put Name on Every Page

4. (16) Atomic Transactions (a) (8) Give the reason why in the timestamp protocol a read operation in a transaction with a lower time stamp than the write timestamp on the data has to be aborted. (b) (8) Give the reason why in the timestamp protocol a write operation in a transaction with a lower timestamp than the write timestamp on the data has to be aborted. (c) (2) T or F At a higher level we have the same problems in correctly using monitors as we had with correctly using semaphores. 5. (5 points extra credit) Process Coordination Explain why disabling interrupts is not appropriate for implementing synchronization primitives in multiprocessor systems.