Computer Science 4630

Spring 2000

Quiz 2

 

This is a closed book test.  Circle the letter of the best answer to each question.

 

  1. Which of the following would be LEAST LIKELY to be performed by a short-term scheduler in an operating system?

(a)   Deciding whether to move a process from disk to main memory.

(b)  Deciding whether to reduce the priority of a process.

(c)   Deciding which process from the ready queue to run next.

(d)  Increasing the priority of a process to avoid a priority inversion.

 

  1. If burst lengths are known in advance, what scheduling algorithm yields the shortest average waiting time for processing a fixed collection of bursts?

(a)   First come first serve.

(b)  Longest job first.

(c)   Shortest job first.

(d)  It doesn’t matter: they all have the same average waiting time.

 

  1. What does the term priority inversion refer to?

(a)   A situation where a process has been assigned the wrong priority.

(b)  A data structure where the priority queue is stored backwards.

(c)   A situation where a low priority process must wait for a high priority process.

(d)  A situation where a high priority process must wait for a low priority process.

 

  1. What problem is the Bakery Algorithm designed to solve?

(a)   The critical section problem for just two processes using busy-waiting.

(b)  The critical section problem for just two processes using semaphores.

(c)   The critical section problem for multiple processes using busy-waiting.

(d)  The critical section problem for multiple processes using semaphores.

 

  1. Which of the following operations would MOST LIKELY need to be inside a critical section?

(a)   Fetch the value of a nonshared variables.

(b)  Fetch the value of a shared variable.

(c)   Reduce the value of a nonshared variable by 1.

(d)  Reduce the value of a shared variable by 1.

 

  1. Under what situation would a spin-lock be preferred over a condition variable (semaphore) in Solaris 2?

(a)   Protection of a short critical section on a single-processor machine.

(b)  Protection of a short critical section on a multi-processor machine.

(c)   Protection of a long critical section on a single-processor machine.

(d)  Protection of a long critical section on a multi-processor machine.


  1. How can a priority inversion be corrected (in the least intrusive way)?

(a)   Temporarily lowering the priority of a high priority process.

(b)  Temporarily raising the priority of a low priority process.

(c)   Not allowing a low priority process to perform system calls.

(d)  Not allowing a high priority process to perform system calls.

 

  1. Which of the following events would be LEAST LIKELY to cause the end of a CPU burst by a running thread?

(a)   Performing an input/output operation.

(b)  Performing a wait on an unblocked semaphore.

(c)   Performing a wait on a blocked semaphore.

(d)  Waiting to receive a message from another thread.

 

  1. Dispatch latency times vary quite a bit among different computers, but it is possible to give a very rough (order of magnitude) estimate of it for typical desktop computers.  Which of the following is closest in order of magnitude to the typical dispatch latency time?  (Suppose that no waiting is required before performing the dispatch.)

(a)   1 nanosecond

(b)  1 microsecond

(c)   1 millisecond

(d)  1 second

 

  1. Which of the following is NOT true about monitors (as a synchronization mechanism).

(a)   Monitors can be used to implement semaphores.

(b)  Monitors can be used to solve the critical section problem.

(c)   Monitors can only be used if they are provided within a programming language.

(d)  Monitors provide wait-free synchronization.

 

  1. Only one of the following would be a feature of an ideal solution to the readers-writers problem.  Which one?

(a)   Allowance for concurrent reading

(b)  Allowance for concurrent  writing.

(c)   Allowance for reader lockout.

(d)  Allowance for writer lockout.

 

  1. A synchronization algorithm is wait-free if, when it is used, no thread

(a)   ever needs to wait for another thread to do anything, under any circumstances.

(b)  needs to wait for any other thread, as long as no thread spends long inside critical sections.

(c)   needs to wait for any other thread that does not want to enter a critical section.

(d)  can be made to wait to enter a critical section while more than some bounded number of other threads enter the critical section ahead of it.