Course overview

This course provides an introduction to parallel programming using threads. Other models of parallel programming are discussed as time permits. The student should learn how to write a correct parallel program, how to measure its efficiency, and how to reason about a parallel program. Student should become familiar with issues, problems, pitfalls, and solutions related to the construction of parallel programs. The class consists of lectures and assignements. Students are asked to write, read, and critique parallel programs. Programs are written in Java. Topics covered in this class include: atomic operations, synchronization, exclusive (atomic) execution of methods, locks, condition queues, thread management, semaphores, counting semaphores, monitors, equivalence of locking constructs, fairnews, deadlock, CSP (communicating sequential processes). Java memory model, deterministic and non-deterministic programs, models for parallel computation, guidelines for the construction of parallel programs. Since this class is an introduction to parallel programming, this class will not provide the final coverage of some topics -- these topics should be re-visited after a class on computer architecture and/or operating systems.

Course schedule

Tentative schedule of lectures

This is a plan. No plan survives contact with reality.

Week Tuesday Thursday
0 02/23: Intro Slides Notes 02/25: Eiffel to Java Slides Example Code, Reduce/Scan Operations Slides Notes
1 03/02: Terminology, exceptions 1 Slides Notes 03/04: Exceptions 2 Slides Notes
2 03/09: Synchronization with locks Slides Notes 03/11: Stack example, visibility Slides Notes
3 03/16: Review of Java for OOP Slides 03/18: Condition queues Slides Notes
4 03/23: Visibility of writes to shared objects Slides Notes 03/25: Safety and liveness properties Slides Notes
5 03/30: Properties of Dekker's solution Slides Notes 04/01: Reasoning about synchronization Slides Notes
  04/06: Holiday 04/08: Holiday
6 04/13: Semaphores Slides (see 04/01) Notes 04/15: Practice proofs
7 04/20: Readers and writers Slides Alternate Version Notes 04/22: Message passing based on CSP Slides
8 04/27: Java and CSP Slides Notes 04/29: Programming with channels, Problem decomposition Slides Set 1 Set 2 Notes
9 05/04: Multi-threading in practice Slides (sorry, big file) 05/06: OpenMP I: Basics Slides Notes
10 05/11: OpenMP II Slides Notes 05/13: Holiday
11 05/18: Models, Linearizability I Slides 05/20: Models, Linearizability II Slides
12 05/25: Performance, Review Slides Notes 05/27: Sample exam
13 06/01: Discussion of sample exam Slides Notes 06/03: Special topics Slides

Groups and assistants

Group name Assistant Room
en_01 Faheem Ullah ML F 40
en_02 Thomas Weibel ML H 43
ge_01 Benjamin Ernst NO E 39
ge_02 Matthias Buechler IFW C 42
ge_03 Christian Klauser CAB G 51
ge_04 Andreas Noever CAB G 57
ge_05 Martin Lanter CHN D 48
ge_06 Enrico Kravina HG E 33.5

Recitation sessions

0 Short Intro to Writing Java Code
1 Exceptions
2 Buffer
3 MergeSort
4 Matrix Multiplication
5 Discussion of Matrix Multiplication
6 Mutual Exclusion (incl. changes by group ge_01)
7 Monitors and semaphores
9 Game of Life
10 OpenMP


Assignments are an important part of the course. You will not learn this material from listening to a lecture alone -- you must do the assignments.

Note: Do not hesitate to ask your teaching assistant if you have troubles with the assignments!

Your grade will be based on the final exam (100%). To get the "testat" (admission to exam), Computer Science BS students must stay around till the end.

Number Out Due Description Solution
1 2010-03-01 2010-03-04 Assignment 1 Intoduction to Subversion Solution Assignment 1
2 2010-03-03 2010-03-11 Assignment 2 Solution Assignment 2
3 2010-03-10 2010-03-18 Assignment 3 Skeleton Solution Assignment 3
4 2010-03-17 2010-03-25 Assignment 4 Skeleton Solution Assignment 4
5 2010-03-24 2010-04-01 Assignment 5 Solution Assignment 5
6 2010-04-13 2010-04-22 Assignment 6 Solution Assignment 6
7 2010-04-22 2010-04-29 Assignment 7 Skeleton Solution Assignment 7 (update)
8 2010-04-29 2010-05-06 Assignment 8 JCSP library,
All .java files as
All .java files as
Solution Part 2, Solution Part 3
9 2010-05-06 2010-05-20 Assignment 9 All .java files as
Solution, Alternative Solution
10 2010-05-20 2010-05-27 Assignment 10 Skeleton (+jomp library) Custom build for jomp in Eclipse Solution
11 2010-05-27 2010-06-03 Assignment 11 Solution

Office hours during the semester break

List of computer rooms with Linux installed

Reading material

There exist a large number of books on programming multi-processors, multi-core system, or threads. Copies of the first two books are "on reserve" the CS library in IFW. The web provides ample information & documentation about Java. Check out the Java Tutorial at Sun's Java site. There are also many other sites ... in many languages.