Quiz #4

Question 1   Multiple Answer (1 points)
  Question: Which of the following statements is true about using special machine instructions (that perform a combination of fetching and storing to a memory location atomically) to achieve mutual exclusion?  
    While a process is waiting for access to a critical section it continues to consume CPU time.
It works for a SMP system.
It can be used to support multiple critical sections; i.e., a process in one critical section will not block processes in other critical sections.
Deadlock is possible.
Starvation is possible.
It is simple.
The (maximum) number of processes that use the critical section must be known in advance.
 

Question 2   Multiple Answer (1 points)
  Question: Which of the following statements is true about using interrupt disabling to achieve mutual exclusion?  
    While a process is waiting for access to a critical section is continues to consume CPU time.
It works for a SMP system.
It supports multiple critical sections; i.e., a process in one critical section will not block other processes in other critical sections.
Deadlock is possible.
Starvation is possible.
It is simple.
The (maximum) number of processes that use the critical section must be known in advance.
 

Question 3   Multiple Answer (1 points)
  Question: Which of the following is true about the Dekker software algorithm to achieve mutual exclusion?  
    While a process is waiting for access to a critical section it continues to consume CPU time.
It is applicable between the processors of an SMP system.
It can be used to support multiple (independent) critical sections; i.e., a process in one critical section will not block processes in other critical sections.
Deadlock is possible.
Starvation is possible.
It is simple.
The (maximum) number of processes that use the critical section must be known in advance.
 

Question 4   Matching (1 points)
  Question: Match the mutual exclusion mechanism with the hardware support for atomicity that it relies on.  
   
 
  Match Question Items
  1. Dekker and Peterson software algorithms
  2. Interrupt disabling
  3. Test and Set and Exchange instruction solutions
 
Answer Items
A. atomic memory fetch and store operations
B. atomic pair of memory fetch and store operations
C. atomic sequence of CPU instructions
 

Question 5   Multiple Answer (1 points)
  Question: Which are true of the (counting) semaphore operation Stallings calls "wait"?  
    it decrements the value of the semaphore
it increments the value of the semaphore
if the value becomes negative, the calling process is blocked
If the value is not positive, another process is unblocked
A lower-level mutual exclusion mechanism is needed, to ensure that the fetching and storing of the semaphore value are done atomically.
 

Question 6   Multiple Choice (1 points)
  Question: A "weak" semaphore is one that  
    does not always achieve mutual exclusion
does not enforce FIFO ordering of unblocking
does not work for more than some fixed number of processes
supports a time-out if a process is blocked for too long
 

Question 7   Multiple Answer (1 points)
  Question: Which of the following are true of the monitor concept?  
    a monitor enforces mutual exclusion around a set of data objects
a monitor may provide a set of condition variables, on which a process may wait
several processes may be executing inside a monitor at the same time
there are several variations on the monitor concept, which differ in details
a semaphore cannot be implemented as a monitor
POSIX mutexes and CVs are intended to implement monitors
monitors were introduced as a built-in programming language construct
 

Question 8   Multiple Answer (1 points)
  Question: Which of the following are true of the pthread_mutex_lock() operation?  
    it takes a reference to a condition variable as a parameter
it takes a reference to a mutex as a parameter
it is intended to provide mutal exclusion
it is intended for waiting for a condition or event
 

Question 9   Multiple Answer (1 points)
  Question: Which of the following is true of pthread_cond_wait()?  
    it takes a reference to a mutex as parameter
it takes a reference to a condition variable as parameter
it is intended to provide mutual exclusion
it unlocks a mutex
it is intended for waiting for a condition or event
a while-loop is required, to recheck what Stallings the logical condition"
it should only be called when the caller is holding the lock on a mutex
when it returns the caller is holding the lock on a mutex
 

Question 10   Multiple Answer (1 points)
  Question: Which of the following is true of pthread_cond_signal()?  
    It matches the Hoare csignal more closely than the Lampson & Redell cnotify
at least one of the threads waiting on the CV will be unblocked
more than one thread waiting on the CV may be unblocked
if there is no thread waiting on the CV, the signal will be remembered, and the next thread to wait on the CV will not block
it takes a reference to a mutex as parameter
it takes a reference to a CV as parameter
 

Question 11   Multiple Choice (1 points)
  Question: If process A is waiting for a nonpreemptible resource that is held by process B and process B is waiting for a nonpreemptable resource that is held by A, that is called:  
    starvation
livelock
deadlock
busy waiting
mutual exclusion
coroutine
 

Question 12   Multiple Choice (1 points)
  Question: If processes A, B, and C are all requesting resource R, but the operating system allows A and B to access R repeatedly while C continues to wait for R, that is called:  
    starvation
livelock
deadlock
busy waiting
mutual exclusion
coroutine
 

Question 13   Multiple Choice (1 points)
  Question: If a process must loop repeatedly, keeping the CPU occupied, to wait for a condition, that is called  
    starvation
livelock
deadlock
busy waiting
mutual exclusion
coroutine
 

Question 14   Multiple Choice (1 points)
  Question: Stallings calls a timing-dependent situation, in which two or more processes continue trying to enter a critical section but none of them succeeds (even though there is no process in the critical section):  
    starvation
livelock
deadlock
mutual exclusion
busy waiting
coroutine
 

Question 15   True / False (1 points)
  Question: The producer/consumer problem is a special case of the reader/writer problem, in which the producer is the writer and the consumer is the reader.  
    True
False
 

Question 16   True / False (1 points)
  Question: In the readers/writers problem we want to allow multiple readers to be in their critical sections for the shared data at the same time.  
    True
False
 

Question 17   True / False (1 points)
  Question: In the reader/writers problem we want to allow multiple writers to be in their critical sections for the shared data at the same time.  
    True
False
 

Question 18   True / False (1 points)
  Question: In the readers/writers problem, we want to allow a reader and a writer to be in their critical sections for the shared data at the same time.  
    True
False
 

Question 19   True / False (1 points)
  Question: If one thread of a process is holding the lock on a mutex, and another thread of the process attempts to lock the mutex, the whole process is blocked.  
    True
False
 

Question 20   True / False (1 points)
  Question: In the producer/consumer problem the producer never has to wait.  
    True
False