



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
The questions from the cse 430 midterms 1 and 2 held in spring 2008. The questions cover various topics such as scheduling algorithms, process coordination, monitors, and real-time scheduling. Students are required to answer questions related to gantt charts, average waiting time, optimality of shortest job first, signal semaphores, spinlocks, monitors, and real-time systems.
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Put Name on Every Page
1. (26) Scheduling Given the following processes: Process # Arrival Time Run Time Priority (1 is highest) A 0 5 3 B 1 3 2 C 3 2 1 (a) (15) Draw a Gantt chart to illustrate the execution of these processes for each of the following 5 CPU scheduling algorithms: Shortest Remaining Time First; Preemptive Priority; Non-Preemptive Priority; Round Robin with q=2 and FCFS. (b) (5) What is the average waiting time for Round Robin with q=2? (c) (3) State why Shortest Job First is provably optimal. You can use a drawing to illustrate this. Hint : There was a class handout with a figure showing why this is true. (d) (3) Why is it essentially impossible to implement Shortest Job First?
Put Name on Every Page
2. (28) Process Coordination (a) (8) Explain how that if the signal semaphore operation is not executed atomically, then for the case where the semaphore controls access to multiple instances of the same type (e.g., 3 printers), access to one or more of the resources could be eliminated. (b) (10) The hardware test-and-set and swap instructions used to provide synchronization, implement memory access operations in a way that we could not assume when developing the software protocols for mutual exclusion. Because of this, software solutions to the critical section problem are unnecessary on a single machine. What is different about the characteristics of the memory operations assumed in the software protocols and the characteristics of the memory operations present in these test-and-set and swap instructions. NOTE : To answer this question you need to state the particular relevant characteristic of the memory operations assumed in the SW protocols and the particular relevant characteristic of the HW instructions. (c) (10) Explain why spinlocks are not appropriate for uniprocessor systems and are ok to use in multiprocessor systems.
Put Name on Every Page Code for a monitor that can implement the C-LOOK disk scheduling algorithm for a disk with n cylinders. data.1 type diskhead = monitor data.2 var busy : boolean ; data.3 up : condition ; data.4 head_position , count , n : integer acquire.1 procedure entry acquire ( desired_cylinder : integer ); acquire.2 begin acquire.3 if busy acquire.4 then if desired_cylinder ≥ head_position acquire.5 then up.wait ( desired_cylinder + count ) acquire.6 else up.wait ( desired_cylinder + count + n ) acquire.7 busy := true ; acquire.8 if head_position > desired_cylinder acquire.9 then count := count + n ; acquire.10 head_position := desired_cylinder acquire.11 end ; release.1 procedure entry release ; release.2 begin release.3 busy := false ; release.4 up.signal ; release.5 end ; initial.1 begin initial.2 head_position := 0; initial.3 count := 0; initial.4 busy := false ; initial.5 end. A process wishing to access cylinder i of a disk whose access is controlled by an instance da of the diskhead monitor must observe the following sequence da.acquire ( i ); ... access cylinder i; ... da.release ;
Put Name on Every Page
4. (16 + 5 points extra credit) Real-Time Scheduling (a) (7) Enter the letter from the figure indicating a time or time interval into the blank space in the list below the figure next to the word that most closely corresponds to it. Conflict resolution Dispatch (Context Switch) Dispatch latency Interrupt processing Process made available Response interval Real-time process execution (b) (6) Why do real-time systems almost never have demand paged virtual memory? (c) (3) Real-time systems can suffer from the priority inversion problem. What is the priority inversion problem? (d) (5 pts. extra credit) The priority inversion problem can be solved by using the priority inheritance protocol. Explain how this works. a b c d e f (^) g