In Reader-writer problem, if a Writer is writing some data, can other reader reads the data at the same time?
If no, this is the code present in Galvin how does it taking care of above situation
Writer's process:
do {
wait(rw mutex);
. . .
/* writing is performed */
. . .
signal(rw mutex);
} while (true);
Reader's process:
do {
wait(mutex);
read count++;
if (read count == 1)
wait(rw mutex);
signal(mutex);
. . .
/* reading is performed */
. . .
wait(mutex);
read count--;
if (read count == 0)
signal(rw mutex);
signal(mutex);
} while (true);