Write a monitor to solve the Reader-Writer problem with the following three requirements in addition to the
Question:
Write a monitor to solve the Reader-Writer problem with the following three requirements in addition to the usual ones regarding reader-writer and writer-writer mutual exclusion. The monitor would provide the following four interface procedures: start-reading, finish-reading, start-writing, finish-writing. A reader or writer would first execute the corresponding start procedure, perform its read or write operation on the shared data which is external to the monitor, and then execute the corresponding finish procedure of the monitor.
This system has many readers and many writers, and all these processes are executing concurrently and asynchronously. The coordination protocol should satisfy the following basic requirements of the reader-writer problem: (1) multiple writers cannot perform writes concurrently, (2) any reader and a writer must be prevented from performing operations concurrently, (3) multiple readers can perform read operations concurrently.
In this problem, we have some additional requirements for fairness. In case readers and writers are competing at the same time to perform their operations, then the following policies will ensure fairness by giving alternating access to the readers and writers. 1. When a writer completes execution of finish_writing(), and if both writers and readers are waiting, allow all the waiting readers to proceed with reading but start blocking any new readers and writers. 2. When any new readers arrive (i.e. executes start_reading() ) while some readers are reading and there are one or more writers waiting, then the new readers should be blocked till a waiting writer is allowed to proceed with writing and finishes writing. Otherwise, new readers can be allowed to proceed with reading if there are no waiting writers. 3. After the last reader finishes executing finish_reading(), and if both writers and readers are waiting, then only one of the waiting writers should be allowed to proceed with writing.
Follow all information above please, no more news.
Value at Risk The New Benchmark for Managing Financial Risk
ISBN: 978-0071464956
3rd edition
Authors: Philippe Jorion