LMU ☀️ CMSI 673
CONCURRENT AND DISTRIBUTED PROGRAMMING
HOMEWORK #2
  1. Study the source code for java.util.concurrent.Semaphore and, if possible, write an analysis of why tryAcquire() without a timeout can break fairness, but tryAcquite(0, TimeUnit.SECONDS) does not.
  2. Write a Java application that returns the sum of the values in an integer array by partitioning the array into N parts, each of which are summed by a unique thread. Use a cyclic barrier whose runnable sums the partial sums.
  3. Rewrite the Java dining philosophers application to use a semaphore for the table and explicit locks for chopsticks. Add some rudimentary graphics to animate the simulation.
  4. Draw a nice picture of a Mandelbrot set using a thread pool in which each thread determines the color of a point. The main thread feeds the pool the pixel coordinates, and waits for the pool (executor service) to finish.