CS 481: Test #1 |
You have 75 minutes to complete this test. The test is open book, open notes. There are four questions of equal weight. Keep your answers short; each problem may have several questions, but each question has a concise and (for an OS question) unambiguous answer.
Problem 1. You have a preemptive scheduling system that works on the following principle: every fixed time period (quantum), a clock interrupts the current process and the OS evaluates the priority of each process in the ready queue (including the process interrupted), choosing that process to dispatch next which has the highest priority. The priority of a process changes with time: for each unit of time spent running, its priority increases by alpha and for each unit spent waiting in the ready queue its priority increases by beta. (Time spent blocked does not affect the priority.) alpha and beta are real-valued constants that can be negative, zero, or positive, depending on the goals of the scheduler.
Problem 2. A computer system completes jobs at the rate of mu jobs per unit time; jobs arrive at the rate of lambda jobs per unit time. If a job arrives when the system is busy, it is queued in a queue of size 5; if the queue is full, the job is simply discarded.
Problem 3. You are to control a one-lane bridge so as to avoid collisions and ensure reasonable efficiency. The bridge is quite long, so you can let several vehicles share it as long as they all go in the same direction; in fact, you should definitely do so in the interest of efficiency. Write pseudocode solutions (i.e., protocols that will avoid collisions, deadlocks, livelocks, and starvation) for routines "Enter bridge from the North," "Enter bridge from the South," "Exit bridge from the South," and "Exit bridge from the North," all routines which must be called by a car before (enter) it enters the bridge and immediately after (exit) it leaves the bridge. You may choose to use semaphores, a monitor, or rendez-vous, but justify your choice.
Problem 4. Define and distinguish deadlock, livelock, and starvation; give a clear example of each. Of the three, only one is detectable; which one and why?
| Back to CS 481 home page |