Problems

Use the following problems to test your concurrency programming prowess. I strongly encourage you to give each problem a try before you turn to the solutions and download the example programs:

  1. Interruptible methods: Write a program that exemplifies the best approach for dealing with an interruptible method.
  2. Fork/join framework: Write a program that relies on the fork/join framework to sum the elements of a list. Write a program that relies on the fork/join framework to compute the Fibonacci number at a given position (for example, F12 = 144). In addition, write a program that exemplifies the usage of CountedCompleter.
  3. Fork/join framework and compareAndSetForkJoinTaskTag(): Write a program that applies the fork/join framework to a suite of interdependent tasks that should be executed only once (for example, task D depends on task C and task B, but task C depends on task B as well; therefore, task B must be executed only once, not twice).
  1. CompletableFuture: Write several snippets of code to exemplify asynchronous code via CompletableFuture.
  2. Combining multiple CompletableFuture objects: Write several snippets of code to exemplify different solutions for combining multiple CompletableFuture objects together.
  3. Optimizing busy waiting: Write a proof of concept to exemplify the optimization of a busy waiting technique via onSpinWait().
  4. Task cancellation: Write a proof of concept that exemplifies the usage of a volatile variable for holding the cancellation state of a process.
  5. ThreadLocal: Write a proof of concept that exemplifies the usage of ThreadLocal.
  6. Atomic variables: Write a program that counts the integers from 1 to 1,000,000 using a multithreaded application (Runnable).
  7. ReentrantLock: Write a program that increments the integers from 1 to 1,000,000 using ReentrantLock.
  8. ReentrantReadWriteLock: Write a program that simulates the orchestration of a read-write process via ReentrantReadWriteLock.
  9. StampedLock: Write a program that simulates the orchestration of a read-write process via StampedLock.
  10. Deadlock (dining philosophers): Write a program that reveals and solves the deadlock (circular wait or deadly embrace) that may occur in the famous dining philosophers problem.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.214.27