Day 88 - The Readers-Writers Problem

Today it will be going to be another synchronization problem called Readers-Writers Problem. It is not a single problem but more than one problems that arise during the process synchronization in the Operating Systems.

The Readers-Writers Problem

Consider we have a database of some sort and some processes that can only read from the database and some that can both read and write to the database. The processes that can read from the database are caller readers and the processes that can read and write from the database are called writers.

The readers can read all they want and will not casue any problem because they are only reading from the database but the problem can arise when the writers are trying to write to the database.

There are many variations to the readers-writers problem. Two of them are following.

First Readers-Writers Problem

The first readers-writers problem states that the reader have priority over the writer. That is unless the reader has permission to access the file, any reader requesting the file will get to access it. This can cause the writer to wait more than average unit time to have access to the file.

Second Readers-Writers Problem

The second readers-writers problem states that the writer should have priority over the readers. This means that when a writer wants to have access to some file only readers which already have access to the file must complete their execution and readers which requested the file after the writer did must wait for the writer to complete its task. This can cause the reader to wait more than average unit time to have access to the file.


zainscizainsci