Midterm: Wednesday, March 6, 11 a.m.-12:15 p.m., usual place (CSB 632) HW3, half due Wednesday, February 20, the rest due Friday, February 22: Chapter 4 exercises: 1, 2, 5, 6, 8, 9, 11, 12, 13, 14 484 only: 3, 4, and 7 ------------------------ Mutual exclusion setting: n looping processes of form Perform noncritical activities (rem) Negotiate authority (try) Perform critical activities (crit) Release authority (exit) The problem: Design each try and exit, to achieve mutual exclusion (safety) and to avoid deadlock (liveness) Also desirable: Avoid lockout/starvation Minimize ``bypasses'' Minimize other resources (e.g., time, space (shared vbles. and their size), shared writing) ------------------------ Summary of limitations: 1. RMW memory needs at least n states to avoid unbounded bypass 2. RMW memory needs at least Omega(sqrt(n)) states to avoid lockout [Lynch] 3. R/W memory needs n shared vbles. to avoid deadlock (even if shared writing (``o.w. easy''), lockout, unbdd. contents) ------------------------ Summary of algorithms: test&set: ``Semaphore'' solution, based on free-for-all grabbing (``A bakery without numbers'') Lockout/starvation possible RMW: The *real* bakery paradigm 2 n-valued shared variables, bundled into one with n^2 values First: ``Now Being Served'' (or authorized) Second: ``Next Available Number'' (modulo n) *No* lockout, or even bypasses (1-bounded waiting) (Improvable to n+O(1) values, still with constant-bdd. waiting [Lynch]) (Improvable to n/2 + O(1) values, if settle for no lockout [Lynch]) [Look now at Herlihy RMW set (but not lower bound yet).] Dijkstra [Lynch]: Historically first R/W soln., but drawbacks: lockout shared writing Burns [Lynch]: Get rid of the shared writing Bakery: Emulate the real bakery paradigm Get rid of *both* drawbacks, most bypasses BUT: Shared variable that is *unbounded* Peterson (via n=2): Bounded variables, but at costs: Shared writing Many bypasses (but still no lockout) ``Fast'': O(1) steps if no contention, but otherwise back to Dijkstra-like