One of the standard problems is the multiple readers/writers problem. Multiple processes may access the same record, either to read it, or to write (update) it. Any number of readers may access the record at the same time, but at most one writer may be accessing the record at a time, and no readers and writers may access the record simultaneously. Several scheduling policies are possible, particularly readers-preferred, writers-preferred, and taking-turns.
All our Memo implementations keep the shared record as a Memo in a folder.
Reading snapshots. The simplest implementation of multiple readers and writers is for the readers to use memo_get_copy and have the writers use memo_get to read and lock the record and memo_replace to write it back, unlocking it.
Several readers can get copies to use at the same time, but when a writer has removed the record, all other readers and writers must wait until it is replaced. However, this is not a perfect solution. It gives the readers a snapshot of the record at an instant, but they may be using their copy for a period of time, communicating with other processes that may be reading a different version of the record.
Simultaneous reading and writing excluded. To prohibit the record changing while readers are still using their copies, readers need to announce that they are beginning to read the record and when they are done. The other three algorithms, readers-preferred, writers-preferred, and taking-turns, all use a status memo in addition to the shared record data memo and use three or four folders to synchronize the processes.
| readers preferred |
| writers preferred |
| taking turns |
This page last updated 09/30/97