High School

When a reader-writer lock is ____ locked, only one thread can have it while all threads attempting to read must wait until it is unlocked.

a. allocate
b. free
c. access
d. read
e. update
f. write

Answer :

A reader-writer lock, when write-locked, only allows one thread to write to the locked resource, blocking all reading threads until it is released. Therefore option e. update and f. write

When a reader-writer lock is write locked, only one thread attempting to write can have it while all threads attempting to read must wait until it is unlocked. Reader-writer locks are a synchronization primitive used to control access to a shared resource in a concurrent computing environment. These locks allow multiple readers to access the resource concurrently, while writers require exclusive access. When a writer holds the lock, all other readers and writers are blocked until the writer releases the lock.