Correct Answer: D. It attempts to decrement the semaphore and blocks if the resource is unavailable
Explanation:
The wait operation acquires one represented resource when the semaphore count permits it.
If none is available, the caller waits according to the semaphore implementation.
Correct Answer: A. It increments the semaphore and may wake a waiting process
Explanation:
The signal operation returns a resource unit or announces that an event has occurred.
A blocked waiter may become eligible to run after the count is increased.
A monitor groups shared state with operations that execute under implicit mutual exclusion.
This reduces the chance of forgetting to acquire and release an external lock correctly.
Correct Answer: D. To notify one or more waiting threads that the relevant state may have changed
Explanation:
A signal makes an eligible waiter runnable so it can recheck the condition while holding the lock.
Because the condition may change again, awakened threads normally test it in a loop.
A reentrant lock records the owner and an acquisition count for repeated locking by that owner.
The lock becomes available to others only after a matching number of releases.
A read-write lock exploits workloads where concurrent reads are safe but writes must be exclusive.
It can improve concurrency compared with one ordinary mutex for all access.
Correct Answer: D. The system as a whole continues making progress even if individual threads may be delayed
Explanation:
Lock-free progress means some operation completes in a finite number of system-wide steps despite contention.
It is weaker than wait-free progress, which guarantees completion for every individual thread.
Correct Answer: A. To grant one thread at a time exclusive access to a protected resource
Explanation:
A mutex has ownership semantics and protects a critical section from concurrent conflicting access.
A thread acquires it before entering and releases it after leaving.
An atomic instruction completes as one indivisible operation relative to competing processors or threads.
No observer can see or interfere with a partially completed update.
Correct Answer: A. Return the old value of a memory word and set it to a new locked value
Explanation:
Test-and-set combines reading a lock value with setting it in one atomic step.
This permits multiple threads to compete for a lock without a race between separate read and write instructions.
Correct Answer: B. It writes a new value only if the current value equals an expected value
Explanation:
Compare-and-swap atomically verifies that a value has not changed before applying an update.
If the comparison fails, the caller can retry using the newly observed value.