Readers/Writers Workbench
Message Passing Solution


The readers/writers (RW) problem is a classic synchronization problem. A set of processes called readers and a set of processes called writers share a common database (DB). The readers just read the value stored in the DB and the writers change the value of the DB. The reader executes an infinite loop in which it reads the value of the database and the writer executes an infinite loop in which it creates a new value and stores it into the DB. The following important conditions have to be satisfied by the readers and writers: This workbench displays a solution to the RW problem using message passing. In this case, the DB is controlled by a database server process to which the readers and writers send read and write requests. Our workbench shows three readers (portrayed as books) and two writers (portrayed as pencils). Colored bullets indicate the position in the reader or writer code for each process. A box labeled DB shows the value of the DB. Readers and writers enter this box when they are allowed to read/write the DB. You can execute the workbench in a step-by-step mode by pushing the step button for each individual process or by moving each process one step forward (STEP button). You can also execute the workbench in a continuous mode by pushing the START button. You will see controls that allow you to change the animation speed.

Workbench