CP: Concurrency: State Models and Design Patterns


Course: 21005 (Autumn Semester 2017)
Lecturer:Prof. Oscar Nierstrasz
Assistants:Pascal Gadient, Leonel Merino
Lecture:Wednesday, 10h15 - 12h00
Exercises:Wednesday, 12h00 - 12h45
Place:Engehaldenstrasse 8, 003
Repetition:Autumn 2019


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.

Course Schedule

1 20-Sep-17 Introduction
2 27-Sep-17 Java and Concurrency
3 4-Oct-17 Safety and Synchronization
4 11-Oct-17 Safety Patterns + Transactional Memory
5 18-Oct-17 Liveness and Guarded Methods
6 25-Oct-17 Lab session
7 1-Nov-17 Liveness and Asynchrony
8 8-Nov-17 Condition Objects
9 15-Nov-17 Fairness and Optimism
10 22-Nov-17 Lab session
11 29-Nov-17 Petri Nets
12 6-Dec-17 Architectural Styles for Concurrency
13 13-Dec-17 Actors — Haidar Osman guest lecture
14 20-Dec-17 Exam


PLEASE READ THIS FIRST! - How to submit your solutions

Week Exercise PDF Solution PDF Introduction PDF
01 E01 S01 I01
02 E02 S02 I02
03 E03 S03 I03
04 E04 S04 I04
05 E05 S05 I05
06 see Lab01 see Lab01 Lab01
07 E07 S07 I07
08 E08 S08 I08
09 E09 S09 I09
10 see Lab02 see Lab02 Lab02
11 E11 S11 I11
12 E12 S12 I12
13 n/a n/a n/a
14 EXAM Q&A Session Slides More Q&A
Last changed by oscar on 5 February 2019