Lecture 14: Concurrency in Java

26 February 2009

Concurrency: motivations for concurrent code; Amdahl’s law and the opportunity for language design. Challenges with concurrent code, including liveness, fairness, scalability. Threads and processes. Java Thread basics. The need for mutual exclusion and serialisation. Monitors in Java: locks and synchronize, condition variables with wait() and notify().

You should read Sun’s tutorial on concurrency to get an introduction to the concurrency facilities provided in Java. Experimentation is essential: try some of the examples inside Netbeans or Eclipse and investigate the facilities for debugging concurrent code.