Computer Science 4630
Summer 2001
Practice questions for quiz 2

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

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

    1. First come first serve.
    2. Longest job first.
    3. Shortest job first.
    4. It doesn't matter: they all have the same average waiting time.

  2. What does the term priority inversion refer to?

    1. A situation where a process has been assigned the wrong priority.
    2. A data structure where the priority queue is stored backwards.
    3. A situation where a low priority process must wait for a high priority process.
    4. A situation where a high priority process must wait for a low priority process.

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

    1. Temporarily lowering the priority of a high priority process.
    2. Temporarily raising the priority of a low priority process.
    3. Not allowing a low priority process to perform system calls.
    4. Not allowing a high priority process to perform system calls.

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

    1. Fetch the value of a nonshared variables.
    2. Fetch the value of a shared variable.
    3. Reduce the value of a nonshared variable by 1.
    4. Reduce the value of a shared variable by 1.

  5. Under what situation would a spin-lock be preferred over a kernel-level semaphore variable in Solaris 2?

    1. Protection of a short critical section on a single-processor machine.
    2. Protection of a short critical section on a multi-processor machine.
    3. Protection of a long critical section on a single-processor machine.
    4. Protection of a long critical section on a multi-processor machine.

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

    1. Performing an input/output operation.
    2. Performing a wait on an unblocked semaphore.
    3. Performing a wait on a blocked semaphore.
    4. Waiting to receive a message from another thread.

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

    1. Allowance for concurrent reading
    2. Allowance for concurrent writing.
    3. Allowance for reader lockout.
    4. Allowance for writer lockout.

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

    1. ever needs to wait for another thread to do anything, under any circumstances.
    2. needs to wait for any other thread, as long as no thread spends long inside critical sections.
    3. needs to wait for any other thread that does not want to enter a critical section.
    4. 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.

  9. An advantage of a preemptive scheduler over a nonpreemptive scheduler is

    1. If a fixed collection of bursts is to be done, the total time to complete the bursts is smaller with the preemptive scheduler.
    2. A preemptive scheduler prevents a process from being locked out of the CPU.
    3. A preemptive scheduler makes solution of the critical section problem easier.
    4. A preemptive scheduler is easier to implement than a nonpreemptive sheduler.

  10. What is a test-and-set instruction, and what is it useful for?