CMPE436 Assignment2- Simulated the game of life Solved

30.00 $

Category:

Description

Rate this product

Write a multi-class multi-threaded Java program that simulates the game of life, which was described in Assignment 1. Each cell will have its own thread dedicated to it to compute the cell’s value in the next generation. This thread will be embedded in a class that is instantiated M*N times by the driver, once for each cell in the grid. Thread synchronization will be done with semaphores. Do not create new threads for generations after the first.

The primary problem you have to solve is coordinating all the cell threads during each generation. A cell thread cannot start computing the new cell value for the next generation until all other cells have completed their computation for the current generation. Use semaphores, that is, P() and V() to solve this problem. You can use BinarySemaphore and CountingSemaphore implementations discussed in class (Do not use Java concurrency library). You will find it extremely helpful to use barrier synchronization.

Question 2- 

Write a multithreaded Java program with 3 threads that has a deadlock in it. Demonstrate the deadlock.

 

Question 3-

Write a multithreaded Java program with 3 threads that has a race condition in it. Demonstrate the race condition.

  • hw2-rm9ujs.zip