Lecture 13: Concurrency Abstractions

24 February 2010

Lecture 13 (given 22nd February): further concurrency control and abstraction mechanisms provided in Java. Data abstraction: ensuring consistency by using library classes for atomic actions or thread-safe datatypes such as concurrent collections. Why these are still not enough . Control abstractions: fine-grained parallelism by decomposing processes into threads, then threads into tasks. Executors in Java. Callables and futures.

Link: Slides.

Homework

You should explore Java concurrency mechanisms in more detail, in particular, using some of the facilities provided by the java.util.concurrent packages.

  • Experiment with a program that exhibits a race condition, and make sure you can fix it in the ways described in the lecture slides.
  • Modify the Pigeon Fancier program you wrote earlier to use the executor framework and allow for dynamic reconfiguration of the pigeon coop.
  • Investigate some of the explicit locking facilities provided in java.util.concurrent and make sure you can explain situations when these might be needed.

See the lecture slides for more detail. Please post questions and discussion here and we’ll follow up.