CS 332 s20 — Writing Concurrent Software
Table of Contents
1 Video Lecture
Please watch the video lecture: It contains sections on
- Introduction (0:00)
- Shared Object Design: Standard OOP + Synchronization (0:33)
- Use a Lock to Protect Object State (3:13)
- Ask When Can This Method Wait and Add Condition Variables (8:23)
- Six Best Practices (13:11)
- What If a Lock is a Bottleneck? (16:25)
- Replace Single Lock With Many, Each Protecting Part of the Shared State (17:34)
- How might we use fine-grained locking to reduce lock contention for the heap? (23:05)
- Partition the Data Among Available Processors (24:22)
- One Thread Per Object—No Locks Needed (27:26)
- Divide System Into Multiple Subsystems Each With Its Own Threads (30:17)
- Lab 3—Design Document (34:07)
- osv Synchronization Primitives (37:44)
- fork() (39:51)
- wait()/exit() (40:47)
- end notes (42:26)
The Panopto viewer has table of contents entries for each slide (https://carleton.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=61ecb50c-cdc1-4ede-b553-abb30114dd92). You can access the lecture slides here.
2 Reading: Concurrent Data Structures
Read OSTEP chapter 29, (p. 353-366). It walks through C implementations of several concurrent data structures and measures their performance.
3 Homework
- If you would like to work with a partner on lab 3, email me by this Friday (5/8). Your email should contain either
- your name, your partner's name, and which of your two osv repos you will use
- OR if you would like me to match you with a partner, send me your timezone and preferred working times. I will do my best to create compatible pairs.
- Starting working on your lab 3 design doc
- Work through the questions in OSTEP chapter 30 (p. 386) to explore how real code uses locks and condition variables to implement producer/consumer queues. Download the code here: http://pages.cs.wisc.edu/~remzi/OSTEP/Homework/HW-Threads-RealCV.tgz