Practical Concurrent and Parallel Programming 2019


In this MSc course, you learn how to write correct and efficient concurrent and parallel software, primarily using Java, on standard shared-memory multicore hardware. The course covers basic mechanisms such as threads, locks and shared memory as well as more advanced mechanisms such as parallel streams for bulk data, transactional memory, message passing, and lock-free data structures with compare-and-swap. It covers concepts such as atomicity, safety, liveness and deadlock. It covers how to measure and understand the performance and scalability of parallel programs. It covers methods to find bugs in concurrent programs.

For exercises and more information, see the course LearnIT site (restricted access). For formal rules, see the official course description.

The course is taught by Thomas Dybdahl Ahle and designed together with Peter Sestoft, Riko Jacob and Claus Brabrand at the IT University of Copenhagen. Teaching assistants are Jorgel Këci, Jon Voigt Tøttrup and Amund Ranheim Lome who help with exercises and approve (or not) the mandatory hand-ins.

Surprises in Parallelism and Java

1 Week 35 Aug 29th Thursday

Concurrent and parallel programming, why, what is so hard. Threads and locks in Java, shared mutable memory, mutual exclusion, visibility, volatile fields, atomic operations, avoiding sharing (thread confinement, stack confinement), immutability, final, safe publication.

Materials: Goetz chapters 1, 2, 3; Sutter paper; McKenney chapter 2; Bloch item 66

Handin at LearnIT.

Threads and Locks

2 Week 36 Sep 5th Thursday

Designing thread-safe classes. Monitor pattern. Concurrent collections. Documenting thread-safety.

Materials: Goetz chapters 4, 5; Bloch item 15; jcip-annotations.jar

Handin at LearnIT.

Performance measurements

3 Week 37 Sep 12th Thursday

Materials: Sestoft: Microbenchmarks and supporting Java code; Optional: McKenney chapter 3, (The Art of) (Java) Benchmarking

Handin at LearnIT.


4 Week 38 Sep 19th Thursday

Java 8 parallel streams for bulk data and parallel array prefix operations. Functional interfaces, lambda expressions, method reference expressions.

Materials: Sestoft: Java Precisely 3rd edition sections 11.13, 11.14, 23, 24, 25; get draft on LearnIT and associated example code. Also File with English words.

Handin at LearnIT.

Threads and Locks 2

5 Week 39 Sep 26th Thursday

Tasks and the Java executor framework. Concurrent pipelines, wait() and notifyAll().

Materials: Goetz chapters 5.3, 6, 8; Bloch items 68, 69

Handin at LearnIT.

Lecture Cancelled

6 Week 40

No exercises or lecture this week.

Threads and Locks 3

7 Week 41 Oct 10th Thursday

Concurrent hash maps: performance and scalability case study.

Materials: Goetz chapter 11, 13.5

Handin at LearnIT.

Fall break

8 Week 42

No exercises or lecture this week.

Threads and Locks 4

9 Week 43 Oct 24th Thursday

Testing concurrent programs.

Materials: Goetz chapter 12; Herlihy and Shavit chapter 3

Handin at LearnIT.

Transactional Memory

10 Week 44 Oct 31st Thursday

Compare and Swap 1

11 Week 45 Nov 7th Thursday

Notice: Lecture will be posted as video thursday afternoon. There won't be anyone in the auditorium in the morning; Description: Optimistic concurrency, lock-free data structures, Treiber stack, compare-and-swap. Consensus number.

Materials: Goetz chapter 15; Herlihy and Shavit sections 5.1-5.2

Handin at LearnIT.

Compare and Swap 2

12 Week 46 Nov 14th Thursday

The Michael and Scott queue, progress concepts, Union Find, work-stealing queues.

Materials: Michael and Scott paper and Chase and Lev paper sections 1, 2 and 5

Handin at LearnIT.

Introduction to Message Passing Concurrency

13 Week 47 Nov 21st Thursday

Introduction to message passing concurrency (no mutable shared memory), Introduction to Erlang, Introduction to Java+Akka.

Materials: Erlang chapter 1, 2, 5. scala.jar.

Handin at LearnIT.

More about Message Passing Concurrency

14 Week 48 Nov 28th Thursday

Message passing (no mutable shared memory), Erlang, Java+Akka.

Materials: Just the slides

Handin at LearnIT.

Exam preparation

15 Week 49 Dec 5th Thursday

Materials: See Materials -> Archive

Handin at LearnIT.

Mandatory course materials




Optional course materials

Even more optional materials