Question 1

Three threads work together to transform a list of data. Thread producer generates a list of integer values and sends them to thread filter that removes all multiples of 10 and passes all other values to thread consumer that sorts them and displays them on the screen. Each of these threads perform their tasks at different speeds. The producer generates a value every 100 milliseconds, the filter processes a value every 500 milliseconds and the consumer continuously reads values. Using the BoundedBuffer class outlined in the lectures and listed in your book write a solution to this problem.

Question 2

Write a program that uses condition variables to control access to a small auditorium in an art gallery. The auditorium has 20 seats and at most 20 people are allowed access at any one time. A person may choose any vacant seat to sit on. It should not be possible for two persons to lay claim to the same seat. However, the search for a seat to sit on should allow for optimal parallel activity.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.