[Edu-sig] this room is occupied (multi-threading metaphor)

kirby urner kirby.urner at gmail.com
Sat Jan 12 03:56:44 CET 2013


I think an obvious way to describe the use of locks when
multi-threading is to use the coffee shop model (same as airplane
model), where there's only one bathroom / toilet.  Or maybe there are
two but each takes its own key.  Or mulitple unisex (still for one
passenger only) like portable ones at the fair.

boyz = threading.Lock()
girlz = threading.Lock()

Only one customer per bathroom at any one time, so there's a queue for
the keys (we call them locks but they're like keys that unlock your
access to the facilities, then you release it back at the counter so
another customer might go).

Kirby

Speaking of airplanes....

Snakes on a plane:
http://gawker.com/5974780/snake-on-a-plane-qantas-passenger-spots-python-on-wing-during-flight
http://xkcd.com/107/


More information about the Edu-sig mailing list