CP: Concurrency: State Models and Design Patterns


Course: 21005 (Autumn Semester 2021)
Lecturer:Prof. Oscar Nierstrasz
Assistants:Pascal Gadient, Mohammadreza Hazhirpasand
Lecture:Wednesday, 10h15 - 12h00
Exercises:Wednesday, 12h00 - 12h45
Place:Engehaldenstrasse 8, 003


This course provides an introduction to concurrent programming with Java. The course focuses on fundamental concepts important for developing correctly functioning concurrent programs, such as safety, liveness and fairness, and on standard programming patterns and techniques for dealing with these issues. The course will include two lab sessions (replacing the regular lecture hours) in which students will work in small groups to apply the techniques presented.

Much of the practical material in this lecture will be based on: Doug Lea, Concurrent Programming in Java: Design Principles and Patterns, Addison-Wesley, 1999. The theoretical foundations will be based on: Jeff Magee and Jeffrey Kramer, Concurrency: State Models & Java Programs, John Wiley, 1999.

Learning Outcomes

On successful completion of this course, you will be able to:

  • Reason about safety, liveness and fairness in concurrent programs
  • Use model-checking tools to prove safety and liveness properties
  • Use synchronization mechanisms to guarantee thread safety in programs
  • Reason about communication mechanisms to manage threads
  • Use practical techniques to avoid deadlock and ensure liveness
  • Reason about architectural styles to avoid concurrency issues


The final grade in the course will be based 30% on exercises and 70% on the final exam.


This course will be held as a “flipped classroom.” Lectures will be made available as hour-long podcasts, with annotated slides available as PDFs. In addition there will be a weekly discussion session lasting 30 minutes to discuss the lecture material, carry out quizzes, and view live demos, followed by an exercise hour. Note that you are expected to study the lecture material in advance of the weekly discussion session.

Depending on the situation with the ongoing Covid-19 pandemic, the weekly discussion sessions may be held remotely or with presence. Further details to follow.

Course Schedule

1 22-Sep-21 Introduction
2 29-Sep-21 Java and Concurrency
3 6-Oct-21 Safety and Synchronizatio
4 13-Oct-21 Safety Patterns + Transactional Memory
5 20-Oct-21 Liveness and Guarded Methods
6 27-Oct-21 Lab session
7 3-Nov-21 Liveness and Asynchrony
8 10-Nov-21 Condition Objects
9 17-Nov-21 Fairness and Optimism
10 24-Nov-21 Lab session
11 1-Dec-21 Petri Nets
12 8-Dec-21 Architectural Styles for Concurrency
13 15-Dec-21 Guest lecture (TBC)
14 22-Dec-21 Exam
Last changed by gadient on 14 July 2021