Question

The Readers-Writers problem poses special challenges to OS synchronization strategies. Describe the Readers-Writers problem showing typical...

The Readers-Writers problem poses special challenges to OS synchronization strategies. Describe the Readers-Writers problem showing typical applications in real life systems. Explain how semaphores may be used to solve this problem. What are the types of possible solutions? Describe the solution for the “Second Reader-Writer Problem” and explain how it works.

Homework Answers

Answer #1

A real life example of a Readers and Writers problem is an airline reservation system consisting of a huge data base with many processes that read and write the data. Reading information from the data base will not cause a problem since no data is changed while the problem lies in writing the information to the data base as data modifies in the database due to the write.

Semaphores are used in the reader writer problem, where it ensures mutual exclusion and also handles the writing mechanism and is common to the reader and writer process code. We basically use two semaphores u.e "mutex" and "wrt". where mutex ensures mutual exclusion and wrt handles te writing mechanism.

Solution to reader-writer problem :

  1. A writer should get exclusive access  i.e. when a writer is accessing the object, no reader or writer may access it.
  2. if a process is reading a file and another process is demanding for the write operation, then it should not be allowed. But read processes are allowed.
  3. Using monitor in the reader-writer problem, Readers can access database only when there are no writers and Writers can access database only when there are no readers or writers.

Solution to 2nd reader-writer problem :

The second readers-writers problem requires that, once a writer is ready, that writer performs its write as soon as possible. In other words, if a writer is waiting to access the shared data, no new readers may start reading.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT