Week 8
Monitors and Java
Monitors
- Marc's Lecture Notes: PDF
- Ben-Ari Ch 7
- begin slide 146
- Dr. Seuss on Deadlock:
- Class participation with monitors: (unfinished business)
- The One-Lane Bridge problem:
Cars coming from the north and south arrive at a one-lane bridge. Cars heading in the same direction can cross the bridge at the same time, but cars heading in opposite directions cannot.
- can we find a way to be safe, fair, and efficient?
- PDF (with thanks to Charlie Hughes!)
- updated with a missing example
Monitors in Java
- Java case study (starter code for Assign 4)
- this version deadlocks!
- you will use two different approaches to fix:
- synchronized methods
- synchronized code blocks
Assignment: Dining Java Philosophers
- Assign 4
- due: Wed, Nov 2, 11:59pm
Channels
- CSP and Go!
- Hoare's 1978 CSP paper: https://spinroot.com/courses/summer/Papers/hoare_1978.pdf
- Rob Pike's Google I/O 2012 - Go Concurrency Patterns: https://youtu.be/f6kdp27TYZs
- Peter Welch's slides introducing CSP and occam-pi (but we will use Go this semester!)
- today:
- Objects Considered Harmful (slide 27 of motivation.pdf slides)
- even though we won't be programming in occam-pi, I want to give you a flavor of it
- because:
- ultimate lightweight processes!
- composition!
- Legoland: slide 83-end of basics.pdf