CMPS 253: Advanced Programming Languages

Concurrent Programming and Transactional Memory



Course Overview

The free lunch is over. It lasted fifty years.

During that time, Moore's law meant that our programs go faster when we buy a next-generation processor. Moving forward, while next-generation chips will have more CPUs, each individual CPU will be no faster than the previous year's model. If we want our program to run faster, we must learn to write parallel programs.

Parallel programs execute in a non-deterministic way, so they are hard to test, and bugs can be almost impossible to detect, reproduce, or fix. Many years of experience has shown that writing a correct parallel programs is typically substantially harder than writing an equivalent sequential program.

In this course, we will survey the state-of-the-art in parallel programming, and the programming languages that support these efforts. We will pay particular attention to the emerging and active field of transactional memory, which adapts many ideas from database transactions to general purpose programming languages. We will also review more traditional lock-based programming, as well as alternative techniques based on functional programming, speculative execution, etc.


Course Materials

Textbook: Transactional Memory, James R. Larus and Ravi Rajwar (preview copy). In addition, we will study a number of research papers on this topic, according to the schedule below.


Prerequisites

CMPS203 Programming Languages, or a similarly semantics-oriented course in programming languages.


Course Expectations and Requirements

  1. Class Participation (30% of total grade) Discussions will be a key part of the class learning experience, and will help you internalize the technical material and understand important connections. Students are expected to (a) complete and take notes on assigned readings before attending class, (b) arrive punctually, and (c) engage actively in class discussions. In this class we will all share responsibility for teaching and learning.

  2. Class Presentations (20% of total grade) Each student will give oral presentations during class on a particular topic, mostly chosen from the textbook. These presentations should highlight the key points – main definitions, theorems, properties, design choices, etc – and should include clear motivation for the topic. Either blackboard or powerpoint presentations are acceptable. Students are encouraged to engage the audience as much as possible, by asking questions and inciting discussion. Each class will consist of one student presentation on a particular topic, followed by (or preferably co-mingled with) a discussion of that topic. If you have little experience giving presentations, please consult Norman Ramsey's advice on How to give a talk.

  3. Presentation Buddy (5% of total grade) Each student presenter will be helped by a corresponding “buddy”, who will listen to and provide constructive feedback on a trial run of the presentation, with the goal of improving the classroom presentation. (You might find two trial runs, one short and one a bit longer, to be helpful.) The buddy grade will correspond to the grade for the resulting classroom presentation.

  4. Scribe (10% of total grade) The “buddy” for each presentation will also function as a “scribe” who documents the classroom discussion. This write-up should not be a repetition of the corresponding book chapters, but an addendum that documents the key insights of the discussion and emphasizes the key points. It should be a PDF file 2-3 pages long and emailed to the Professor before the next class for posting on the web page.

  5. Homework (15% of total grade) Homeworks will be assigned during the quarter, and are expected to be completed on time, before the start of the class when they are due. Late homeworks will be deducted 10% for each day (or fraction of day) late.

  6. Project (20% of total grade) Students will complete a class project, either individually or in pairs. The project will offer each student broad latitude to tailor a project to his or her own interests; possibilities include a design project, a programming (application) project, an implementation project, or a theory project. Oral and written presentations of each project are expected.

There will be no examinations.


Class Schedule

This schedule is quite tentative, and will certainly change as the quarter progresses. In particular, you should be prepared to present one class before your scheduled slot, in case the discussion of the preceeding topic finishes early.

Date

Topic and Reading

Presenter

Scribe

4/3

Introduction, administrivia.

Cormac

4/5

Current standard practice.
An Introduction to Programming with Threads. Andrew D. Birrell.
If you're interested, there's a newer version for C#:
An Introduction to Programming with C# Threads. Andrew D. Birrell.

Dave Ilstrup
(slides)
Jaeheon Yi

4/10

Problems with current practice.
Threads Cannot Be Implemented As a Library. Hans Boehm.
The Java Memory Model. Jeremy Manson, William Pugh, Sarita V. Adve.
Deprecated: The Java Memory Model is Fatally Flawed. William Pugh.

Aaron Tomb Alamelu Sankaranarayanan
(notes)

4/12

A trilogy of concurrent languages: ML, Haskell, and Lisp.
Concurrent ML John H. Reppy
First-class Synchronous Operations. John H. Reppy.
A Multi-threaded Higher-order User Interface Toolkit. EMDEN R. GANSNER and JOHN H. REPPY.

Avik Chadhuri Kenn Knowles
(notes)

4/17

Concurrent Haskell. Simon Peyton Jones, Andrew Gordon, Sigbjorn Finne.
Developing a High-Performance Web Server in Concurrent Haskell. Simon Marlow.

Kenn Knowles Avik Chadhuri

4/19

Class cancelled.

4/24

Homework 1 discussion and initial submission
The most beautiful concurrency abstraction, if it fits.
MapReduce: Simplified Data Processing on Large Clusters. Jeffrey Dean and Sanjay Ghemawat.
Optional reading:
Interpreting the Data: Parallel Analysis with Sawzall. Rob Pike, Sean Dorward, Robert Griesemer, Sean Quinlan.
Google's MapReduce Programming Model -- Revisited. Ralf Lammel.

Bogdan Alexe Karl Schnaitter
(notes)

4/26

Multilisp: A Language for Concurrent Symbolic Computation. Robert Halstead.

Jordan Johnson

Caitlin Sadowski
(notes)

A Multilisp/C hybrid.
A Minicourse on Multithreaded Programming. Charles E. Leiserson, on Cilk.

Caitlin Sadowski (notes)

5/1

Homework 1 Due by 2am.
Dynamic detection of concurrency errors, plus the notion of Serializability.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs. Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, and Thomas Anderson.
Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs. Cormac Flanagan, Stephen N. Freund.

Jaeheon Yi David Ilstrup
(notes)

5/3

Linearizability, a stronger/more complex correctness property.
Linearizability: a correctness condition for concurrent objects. Maurice P. Herlihy, Jeannette M. Wing.

Karl Schnaitter Bogdan Alexe
(notes)

The Landscape of Parallel Computing Research: A View from Berkeley. Krste Asanovic, Ras Bodik, Bryan Christopher Catanzaro, Joseph James Gebis, Parry Husbands, Kurt Keutzer, David A. Patterson, William Lester Plishker, John Shalf, Samuel Webb Williams and Katherine A. Yelick.

Bo Adler

Aaron
(notes)

5/8

Now, on to transactional memory.
Chapter 1 of the Transactional Memory book.
PROCESS STRUCTURING, SYNCHRONIZATION, AND RECOVERY USING ATOMIC ACTIONS. D. B. Lomet.
Language Support for Lightweight Transactions. Tim Harris, Keir Fraser.
Optional background reading.
Exceptions and side-effects in atomic blocks. Tim Harris.

Sangeetha Suresh
(notes)

5/10

AtomCaml: First-Class Atomicity via Rollback. Michael F. Ringenburg, Dan Grossman.
Background reading.
Chapter 2 (mainly sections 2.1 and 2.2) of the Transactional Memory book.

Caitlin Jaeheon
(notes)

5/15

Homework 2 part 1 due.
Beautiful concurrency in Haskell.
Composable Memory Transactions. Tim Harris, Simon Marlow, Simon Peyton Jones, Maurice Herlihy.
Transactional memory with data invariants. Tim Harris and Simon Peyton Jones.
A gentle intro, if you find it helpful:
Beautiful concurrency. Simon Peyton Jones.

Esteban Molina-Estolano

5/17

Speculative Execution.
ENERGY-EFFICIENT THREAD-LEVEL SPECULATION. Jose Renau, Karin Strauss, Luis Ceze, Wei Liu, Smruti Sarangi, James Tuck, and Josep Torrellas.
Tasking with Out-of-Order Spawn in TLS Chip Multiprocessors: Microarchitecture and Compilation. Jose Renau, James Tuck, Wei Liu, Luis Ceze, Karin Strauss, Josep Torrellas.

Guest Lecture:
Jose Renau

5/22

Homework 2 part 1 due.
A high-performance STM.
McRT-STM: A High Performance Software Transactional Memory System for a Multi-Core Runtime. Bratin Saha, Ali-Reza Adl-Tabatabai, Richard L. Hudson, Chi Cao Minh, Benjamin Hertzberg.
Compiler and Runtime Support for Efficient Software Transactional Memory. Ali-Reza Adl-Tabatabai, Brian T. Lewis, Vijay Menon, Brian R. Murphy, Bratin Saha, Tatiana Shpeisman.

Alamelu Sankaranarayanan Sangeetha
(notes)

5/24

Limitations of atomicity.
Deconstructing Transactional Semantics: The Subtleties of Atomicity. Colin Blundell, E Christopher Lewis, Milo M. K. Martin.
Automatic Mutual Exclusion. Michael Isard and Andrew Birrell.

Suresh

5/29

Haskell on a Shared-Memory Multiprocessor. Tim Harris, Simon Marlow, Simon Peyton Jones.

Karl

5/31

The Great Debate: What is the "right" way to program multi-core/kilo-core?

Please think deeply about your opinions on this topic for at least an hour, given the context of the course (and your other knowledge/experience), and come prepared to present and defend your views.
Topics to think about include: what programming models have we considered; what are their benefits/limitations/performance overheads; software productivity and quality concerns; programmer-time vs hardware-cost trade-offs; different approaches for different application domains; evolving application mix over the next 10 years, where do we need extra cycles; etc.

Time permitting, we may also discuss:
Data Parallel Haskell: a status report. Manuel M. T. Chakravarty, Roman Leshchinskiy, Simon Peyton Jones, Gabriele Keller, and Simon Marlow.

6/5

Project presentations.
* Kenn, Aaron: A concurrent SAT solver.
* Avik: Implementing CML primitives in Concurrent Haskell.
* Karl: Automatic parallelization.
* Jaeheon, Caitlin, Esteban: A highly-concurrent Queue.

6/7

Project presentations, STM Day.
* David
* Bodgan
* Alamelu, Sangeeta, Suresh

6/14

Final reports due in PDF format sent via email to the instructor. Should be somewhere around 1000 words long.


Homeworks


Project plans


Possible project ideas


Useful resources