Course overview
Processors are no longer growing faster. Instead, they are growing ever more parallel. Hardware architects are no longer using the additional transistors afforded by Moore's Law to make sequential processors faster, but instead to put more processing cores on a single chip, leading to so-called chip multiprocessors, or simply multicore processors. Unfortunately, this creates a problem for us, programmers. Before the turn of the century, you could simply wait another year and your program would run faster on next-generation processors. This free lunch is now officially over: you'll have to learn how to successfully write concurrent and parallel programs if you want your programs' performance to continue to scale with the hardware capacity.
This year, the course will primarily involve programming in Java, Erlang and Clojure. All of these programming languages feature direct support for concurrent programming. If you question the usefulness of non-mainstream functional languages like Erlang and Clojure, I am not alone in thinking that the ideas embedded in these languages are important going forward. Here is a preliminary list of topics to be discussed:
- Multicore Processors: what and why?
- Parallelism: Amdahl's Law, Gustafson's Law, speedup and scalability
- Hardware primer: architectures, caches, cache coherence
- Parallelism vs. Concurrency
- Parallelism: DAG model, fork/join, the Java Fork/Join framework
- Concurrency: shared-memory multithreading (in Java): locks, race conditions, deadlock
- Concurrency: message-passing models: actors, processes, channels (Clojure core.async)
- Actors in practice: an introduction to Erlang
- Practical functional programming: an introduction to Clojure
- Software-transactional memory
- (Time permitting: Google's MapReduce abstraction: parallel programming for data centers)
Is this course for you? (aka prerequisites)
I don't expect students entering this course to have any prior knowledge on concurrency or parallelism (after all, that is the topic of this course). I do expect advanced programming skills. In particular, I will not be explaining standard sequential programming in Java (i.e. I assume you have basic knowledge of object-oriented programming in a mainstream OO language such as C++/Java/C#).
I will introduce standard sequential programming in Erlang and Clojure, so no prior knowledge of these languages is necessary. However, as both of these languages are primarily functional, having had prior exposure to a language with first-class functions and higher-order programming is a big plus. For VUB students, having followed the SICP courses (structure and intepretation of computer programs) should be sufficient. For ULB students, it is highly recommended to first take this course as an elective.
2013-2014 Schedule
Date | Topic |
12/2 | Introduction, Laws of Parallel Programming, Hardware/Software Models |
19/2 | Erlang: introduction, sequential programming, concurrent programming |
26/2 | Erlang: distributed programming, fault tolerance, simple chat, multicore support |
05/3 | Java Concurrency: Introduction to concurrency in Java
Erlang project assignment announced |
12/3 | Clojure: introduction, sequential programming, sequences |
19/3 | Clojure: persistent data structures, state and concurrency (refs, atoms, agents) |
26/3 | Clojure: software-transactional memory, meta-circular implementation in Clojure
Clojure project assignment announced |
02/4 | Clojure: STM in Clojure |
09/4 | Easter Holiday |
16/4 | Easter Holiday |
23/4 | Java Parallelism: Fork/Join, Analysis of Fork/Join programs |
27/4 | Erlang project deadline |
30/4 | Java Parallelism: Fork/Join Parallel Prefix |
07/5 | Java Concurrency: Shared-memory multithreading
Java project assignment announced |
14/5 | Concurrency: shared-memory wrap-up + message-passing models (Actors vs Threads) |
18/5 | Clojure project deadline |
21/5 | Concurrency: channels |
15/6 | Java project deadline |
Study material
The main study material used in this course are slides, which can be downloaded from Pointcarre. For each lecture, I also provide relevant pointers to the literature (mostly to articles, books or papers freely available online). You are expected to at least read up on the "required reading" material referenced below.
Lecture 1: Introduction
Slides available on Pointcarre.
Source code
Required Reading:
Additional in-depth reading:
Lectures 2 & 3: Erlang
Slides available on Pointcarre.
Source code
Good, compact overview of the core language:
Additional in-depth reading:
Lecture 4: Introduction to concurrency in Java
Slides available on Pointcarre.
Source code
Required Reading:
Additional in-depth reading:
Lectures 5 & 6: Introduction to Clojure, Concurrency in Clojure
Slides available on Pointcarre.
Source code
Required Reading:
Additional in-depth reading:
Lectures 7 & 8: Software-transactional Memory
Slides available on Pointcarre.
Source code on github
Required Reading:
Additional in-depth reading:
Lectures 9 & 10: Fork/Join Parallelism
Slides available on Pointcarre.
Source code
Required Reading:
Additional in-depth reading:
Lecture 11a: Advanced shared-memory Concurrency
Slides available on Pointcarre.
Required Reading:
Additional in-depth reading:
Lecture 11b: Message-passing Concurrency: Actors vs Threads
Slides available on Pointcarre.
Source code
Required Reading:
Lecture 12: Channel-based Concurrency
Slides available on Pointcarre.
Required Reading:
Additional in-depth reading:
- Rich Hickey's rationale behind the design of the Clojure core.async library.
- Concurrency in the Go programming language. Go is a relatively new language designed by Rob Pike at Google. It uses a model of concurrency based on CSP, but with weaker guarantees (e.g. processes, called goroutines in Go, are not fully isolated).
- The Occam-pi programming language. Occam-pi was one of the first practical programming languages building upon the CSP channel-based concurrency model.
Lecture 13 (Time permitting): MapReduce
Slides available on Pointcarre.
Source code on github
Required Reading:
Additional in-depth reading:
Assessment and examination
For the theoretical part of this course, students are expected to attend the lectures and to read the required reading material. For the exercises, students are expected to attend the lab sessions.
Examination for this course is fully project-driven:
- The first programming project is to be made in Erlang (1/3 of the total score). The focus of this project is on the correct use of actors to manage concurrency.
- The second programming project is to be made in Clojure (1/3 of the total score). The focus of this project is on the correct use of shared-memory abstractions to manage concurrency.
- The third programming project is to be made in Java (1/3 of the total score). The focus of this project is on the efficient use of Fork/Join to speed up a computation using parallelism.
- All three projects are to be completed individually.
- All three programming projects must be submitted together with a brief accompanying report (see the project assignment for details on what should be in the report).
- Students must submit a solution for all three projects, and participate in the oral examination, in order to pass this course.
There is no traditional written exam for this course.
During the oral exam (~25min), we will discuss your projects.
There is no need to prepare a formal presentation. You will be asked
to sketch your design, discuss your experiments and relate your
findings to the topics seen during the lectures.
Project schedule and deadlines 2013-2014
- Erlang project announcement: 05/03
- Clojure project announcement: 26/03
- submit Erlang project: 27/04
- Java project announcement: 07/05
- submit Clojure project: 18/05
- submit Java project: 15/06
- project defenses 1st session: 24/06 and 25/06
Project assignments are made available via Pointcarré.