1. Which of the following is true ?
A) semaphores are usually implemented using locks
B) condition variables are associated with monitors
C) both of the above
D) neither of the above
2. The problem with locks is that
A) all processes need to know the key
B) they’re not applicable to more than two processes
C) they use busy-waiting
D) all of the above
3. We can prevent
deadlock from occurring by ensuring that the __________
condition
cannot hold.
A) mutual exclusion
B) no preemption
C) circular wait
D) any of the above
4. A race condition ____.
A) results when several threads try to access the same data concurrently
B) will result only if the outcome of
execution does not depend on the order in which
instructions are executed
C) results when several threads try to access and modify the same data concurrently
D) None of the above
5. An instruction that executes atomically ____.
A) must consist of only one machine instruction
B) cannot be used to solve the critical section problem
C) executes as a single, uninterruptible unit
D) All of the above
SOLUTION-(1):- (C) both of the above
EXPLANATION:- semaphores which are restricted to the values 0 and 1 are designated as binary semaphores and are utilized to implement locks. condition variable represents the queue of threads, associated with a monitor, on which a thread may wait for some condition to becomes true.
SOLUTION-(3):- (D) any of the above
SOLUTION-(4):- (C) results when several threads try to access and modify the same data concurrently.
SOLUTION-(5):- (C) executes as a single, uninterruptible unit.
===========================================================================
Get Answers For Free
Most questions answered within 1 hours.