Question

Part 2 is a variant of the classic reader-writer problem. Part 1's specification does not require strict alternating of writers and readers. As a result, some updates of the writers may

be missed by readers. And some contents may be read more than once. Part 2's setup, on the other hand, will result in strict alternating between writers and reader. In Part 2, we assume that we will have many writers, and one reader. The one reader reads from the shared string and prints the contents to the standard output. Several writers write to the same shared string. Only one writer can write to the string at any time. And once any writer writes, the reader should display it before other writers change the contents. In some sense, the reader is like a display server that displays the contents of the buffer.

Fig: 1