Problem 1. Two threads are said to have a race condition if the value of a shared variable is dependent on the order in which the instructions for the two threads are executed. Set up a race condition between two threads. By inserting delay loops as needed, exhibit the race condition by having your program calculate different values for the same shared variable.
Problem 2. Implement the producer-consumer solution from class. Producers produce integers; consumers consume the integers by printing them. Run your program using 2 producer and 3 consumer threads.
Problem 3. Create a "monitor" process that has several procedures. The monitor monitors a request pipe, waiting for requests from other procedures. When a process wishes to invoke a monitor procedure, it sends a request containing the procedure name and parameter to the monitor by writing to the request pipe. It then blocks by reading from a reply pipe. The monitor process repeatedly reads requests from the request pipe. For each request, it invokes the corresponding procedure as a separate thread. This thread may use the c.wait operation to block itself and the c.signal operation to wake up other threads. When the procedure thread terminates, the monitor process sends the result to the original calling thread by writing to the appropriate reply pipe. Run this assignment using five named pipes, one request pipe and four reply pipes. In addition to one monitor, have four client processes, each with its on reply pipe. Have your threads use mutexes and condition variables to get as much parallelism as possible in your monitor process.
I don't care what your monitor procedures do as long as it is something interesting.
In addition to the code, turn in transcripts showing your programs in action for all three problems.