Regarding the motivation of this exercise. Although I am not the original poster, I see there's a need to provide some further background.
The readers-writers problem is an elementary problem in concurrency, and the typical solution involves the use of condition variables. The construct has its origins in 1974/1975 when Hoarse and Hansen formulated the idea of monitors.
The Art of Multiprocessor Programming introduces this problem in Chapter 1. Their example has Alice and Bob place sentences on a billboard one letter at a time.
"Both the mutual exclusion and producer-consumer protocols require waiting: if one participant is subjected to an unexpected delay, so is the other. ... Surprisingly, the readers-writers problem does have solutions that do not require waiting.
The scope of this exercise is no doubt to provide a working demonstration based on the method of condition variables. Again, the wikipedia article should prove informative.
In reply to Re: Threads sharing global variable
by Anonymous Monk
in thread Threads sharing global variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |