In the class we mentioned briefly the readers-writers problem with writers priority. The problem can 1 answer below »

In the class we mentioned briefly the readers-writers problem with writers priority. The problem can be solved in guarded commands as follows: void reader() { when ( writers == 0 ) [ readers++; ] //read [readers–;] } void writer() { [writers++;] when ( (readers == 0) && (active_writers == 0) )[ active_writers++; ] //write [writers–; active_writers–;] }

Here writers represents the number of threads that are either writing or waiting to write. The variable active_writers represents the number of threads ( 0 or 1 ) that are currently writing. Implement the solution using either POSIX threads or SDL threads. Again simulate the tasks by reading from and writing to a file named counter.txt

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer