CS 102 (Spring 2003)
Quiz 3: Exclusion
Quiz
Posted
Given in class
20
Feb
25
Feb
Three approaches for exclusion:
Eliminate the need through immutability
Dynamic locks
Hiding
What causes deadlock?
How can deadlock be avoided through resource ordering?
For thread-shared storage, what properties are of interest for correctness of concurrent programs?
Atomicity -- what is guaranteed and what must be provisioned by the programmer?
Visibility -- when are shared-variables updated?
Instruction ordering -- on what can you depend?
What conditions are necessary for method confinement of an object?
Puzzler: Given a Set s, how would you write a class
SetLock
patterned after
DoubleLock
, so that you could write:
new SetLock(s).lockInvoke(r)
The above line would hold a lock on every Object in
s
and only then run the supplied Runnable.
Last modified 11:49:34 CST 20 February 2003 by
Ron K. Cytron