Origin: | Lea 97 | |||
Reason: | To allow concurrent read access to an object, but exclusive write access. | |||
Synopsis: | Use a specialized Scheduler whose method enter is replaced by two methods: readLock and writeLock. | |||
Example: | An on-line auction system where remote users get and set bids. | |||
Solution: |
In a very simple form, a Read/Write Lock is sketched as follow.
Method readLock looks like: Method writeLock looks like: Method done looks like: Note that activeWriters is either 0 or 1. |
|||
See also: |
Scheduler |