Week 4
Lecture Notes
Critical Sections
- Recap from last week:
- UPC setup, including ssh keys and script to compile/run
- Finish up demo of last two versions of UPC temperature programs
- vim questions? tips/advice?
- Programming assignment 2 due: next Tue, Feb 17
- Ben-Ari Ch 3
- slides: PDF
- begin slide 3.1, p. 50
- The approaches to enter and exit critical sections were low-level and brittle
- low-level because: relied on busy-waiting and checking on global variables
- brittle because: many reasons!
- processes relied on each other to enter their own CS!
- hard-coded for a specific number of processes (i.e., 2)! what about for n?
Class Exercise
- More practice with interleavings
- (Adapted from Problem 2.19 from Andrews's MPD text)
- mpd-2.19-interleavings.pdf (handout)
Semaphores
- Next we introduce the abstraction of semaphores to control access to CS
- Ben-Ari Ch 6
- slides: PDF
- begin slide 6.1, p. 111
Homework
- Written HW: Ben-Ari p. 39:
- Exercises 2, 3, and 4
- Haven't forgotten that I owe you feedback–sorry!
Programming Assignment 2
- UPC Exercises 1.1 through 1.7
- Due: Tue, Feb 17, 11:59pm
- Here's a link: private