70 likes | 152 Views
Learn about concurrency models, synchronization, and memory safety in programming projects. Implement atomic unit actions to prevent deadlocks and ensure realism in room simulations. Understand and utilize language features effectively for grading.
E N D
Programming Languages:Design, Specification, and Implementation G22.2210-001 Rob Strom November 9, 2006
Other readings on ML http://www.dcs.ed.ac.uk/home/stg/NOTES/notes.html
Readings (week 1) • Theoretical and Historical Papers on Concurrency • The “Readers/Writers” Problem http://www.md.chalmers.se/~ptrianta/SynC+Co/LIT/lamp77.pdf.gz • Shared Registers (Part II) http://users.ece.gatech.edu/~dblough/6102/lamport_consistency.pdf • Wait-free synchronization http://www.cs.brown.edu/~mph/Herlihy91/p124-herlihy.pdf • Partially-ordered time. http://research.microsoft.com/users/lamport/pubs/time-clocks.pdf • Concurrency models in object-oriented languages • Ada Reference Manual Section 9 • Java Reference Manual Chapter 17 • Thinking in C++, chapter 11 • http://web.mit.edu/merolish/ticpp/TicV2.html#_Toc53985862
Readings (week 2) • Problems with the Memory Model • Java Memory model is Broken http://www.cs.umd.edu/~pugh/java/broken.pdf • Thread-Safe Programming • Compiler-Enforced Thread-Safety (Guava): http://researchweb.watson.ibm.com/people/d/dfb/papers/Bacon00Guava.ps • Safe Reader-Writer Parallelism (Optimistic Readers): http://www.research.ibm.com/distributedmessaging/paper13.html
Programming Project on Concurrency – due Nov. 30 • Extend the room world of the previous assignment so that multiple people can enter rooms and do things • Each thing someone does is an atomic unit of work, e.g. • Get things from factories and put them in the room • Pick up a bunch of objects and put them in a container • Pick up 2 containers and a funnel and transfer liquid from one container to the other • Don’t deadlock • Anticipate contention – e.g. you’ve picked up object A and try to pick up object B, but discover it’s gone because someone else picked up object B. You may need to give up your scripted action. • The implementation should have the same realism properties as the non-concurrent implementation did: e.g. things shouldn’t spontaneously disappear or appear in multiple places. • You may use any one of C++, Java, or Ada (probably the same language you used for previous assignment, but this is not required)
Notes on Grading of Projects • The bulk of the points should go for understanding the assignment and correctly using the features of the languages being tested (e.g. in the polymorphism assignment, triggering run-time dispatching, and sharing a common interface). • The next group of points is for clear documentation of the components, and what they do. • The last group of points should be for correctness, freedom from bugs, conformity to test cases.
Homework:ML Type Inference Problem • Type inference: fun zip f nil nil = nil | zip f (h::t) (i::s) = f(h,i)::zip f t s; What does it do? What is its most general type? • Consider these two expressions (1) fun f g = g 7 + g false; (2) let val g = fn (x) => 20 in g 7 + g false; Why is (1) incorrectly typed and (2) correctly typed? What is the type of g in (2)?