Semaphore ImplementationYou are to design and develop your own implementation of a Semaphore, and then use that semaphore to develop the solution to the consumer-producer problem described below. The semaphore data structure and operations (P, V, initialize) that you design must include a blocking feature to eliminate (or really, reduce) busy-waiting. (You should consider using your spin-lock solution in implementing the semaphore operations.) Using your semaphore mechanism, you should implement the necessary code for CSenter and CSexit that will protect a critical section of code. In effect, your are simulating the semaphore operations. You are not permitted to use semaphores or semaphore operations that are part of the operating system; you are constructing your own!
The problem that you are to solve is a consumer-producer problem. Using **at least** four processes ( two or more producer processes and two or more consumer processes), develop a concurrent program that produces values and consumes them. The values that are produced should be placed in a multi-element shared buffer. The **shared buffer** is one that is **in main memory** and accessible to all of the processes of the program. Obviously, you should use your semaphore implementation to ensure that the processes properly and safely access this shared buffer.
Consumer processes and producer processes should be able to execute concurrently, whenever the buffer state has one or more filled or or one or more empty cells, respectively.
You are to design a method of demonstrating and testing the program so that you can assure yourself, and me, that it is working properly, for varying speeds of producers and consumers. Refer to the document on materials to submit with your homework.
Due: Sunday November 2
CAN SOMEBODY HELP ME WITH THIS