Question: Please help me with this program in c++. Thanks in advance. Goal: Implement and test a solution to the Readers-Writers Problem for writers-first, also known
Please help me with this program in c++. Thanks in advance.

Goal: Implement and test a solution to the Readers-Writers Problem for writers-first, also known as the second readers-writers problem. Your solution must utilize semaphores. Description -Semaphore Solution: A solution to the Readers-Writers problem using semaphores is available in the paper Concurrent Control with " Readers" and " Writer" that is available from the class web page on webct. You are to use their solution to the second problem. You must use semaphores in your solution. Using reader-writer locks or other higher level constructs will be worth zero points. Description - Code: This program may be completed in C, C++, or Java. The Java approach Description needs to be designed for Threads. The C/C++ approach can be designed for Threads (using pthread library) or for independent processes (using shared memory). In all approaches, your code must be modular so that it can be compiled and executed with our test cases. To comply with this, your code must expose a standard interface located in the files: rw.h, rw.c for C; rw.h, rw.cc for C++; and RWjava for java. The interface consist of following six procedures/methods: void Entry SectionReader(): A reader will call this method when it wants to enter its critical section. The method should not return until the reader is allowed access to the critical section. void Entry SectionWriter(): A writer will call this method when it wants to enter its critical section. The method should not return until the writer has exclusive access for executing its critical section. The method should not return until the writer has exclusive access for executing its critical section. void ExitSectionReader(): A reader will call this method when it leaves its critical section. void ExitSectionWriter(): A writer will call this method when it leaves its critical section. void Initialize(): This method should setup the shared memory and semaphores (create and initialize to correct values). This method needs to be called before any calls to the Entry or Exit methods. A second call to Initialize is an error if there was not an earlier call to CleanUp. void CleanUp(): This method should return to the system any system-wide resources created in the Initialize call such as semaphores and shared memory segments. After a call to CleanUp, the program should be back to its pre-initialized state. Goal: Implement and test a solution to the Readers-Writers Problem for writers-first, also known as the second readers-writers problem. Your solution must utilize semaphores. Description -Semaphore Solution: A solution to the Readers-Writers problem using semaphores is available in the paper Concurrent Control with " Readers" and " Writer" that is available from the class web page on webct. You are to use their solution to the second problem. You must use semaphores in your solution. Using reader-writer locks or other higher level constructs will be worth zero points. Description - Code: This program may be completed in C, C++, or Java. The Java approach Description needs to be designed for Threads. The C/C++ approach can be designed for Threads (using pthread library) or for independent processes (using shared memory). In all approaches, your code must be modular so that it can be compiled and executed with our test cases. To comply with this, your code must expose a standard interface located in the files: rw.h, rw.c for C; rw.h, rw.cc for C++; and RWjava for java. The interface consist of following six procedures/methods: void Entry SectionReader(): A reader will call this method when it wants to enter its critical section. The method should not return until the reader is allowed access to the critical section. void Entry SectionWriter(): A writer will call this method when it wants to enter its critical section. The method should not return until the writer has exclusive access for executing its critical section. The method should not return until the writer has exclusive access for executing its critical section. void ExitSectionReader(): A reader will call this method when it leaves its critical section. void ExitSectionWriter(): A writer will call this method when it leaves its critical section. void Initialize(): This method should setup the shared memory and semaphores (create and initialize to correct values). This method needs to be called before any calls to the Entry or Exit methods. A second call to Initialize is an error if there was not an earlier call to CleanUp. void CleanUp(): This method should return to the system any system-wide resources created in the Initialize call such as semaphores and shared memory segments. After a call to CleanUp, the program should be back to its pre-initialized state
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
