110 likes | 227 Views
Complexity of Weak Consistency Models. Madan Musuvathi Research in Software Engineering Microsoft Research. Weak Consistency Models. Hard to program Hard to test Hard to debug General consensus: trade consistency for Availability Performance Partition-tolerance ….
E N D
Complexity of Weak Consistency Models Madan Musuvathi Research in Software Engineering Microsoft Research
Weak Consistency Models • Hard to program • Hard to test • Hard to debug • General consensus: trade consistency for • Availability • Performance • Partition-tolerance • …
Quantifying the Cost of Weak Consistency • How hard are weak consistency models to program/test/debug? • Study the hardness of associated verification problems • Assumption: • Programming models that are hard for computers to reason are also hard for humans
Memory Consistency Models • A memory consistency model is an abstraction of the memory subsystem • Defines when and in what order memory operations from one thread are visible to others • Sequential consistency is what programmers want, but is expensive
Quiz: Can this assert fail ? Answer: depends on the memory model ! Init: x = 0; y = 0 x = 1; t = y; y = 1; u = x; assert( ! (t == 0&& u == 0) )
Sequential Consistency Can the assert fail? No Init: x = 0; y = 0 x = 1; t = y; y = 1; u = x; assert( ! (t == 0 && u == 0) ) SC
x86 Memory Model Can the assert fail? Yes Init: x = 0; y = 0 x = 1; t = y; y = 1; u = x; assert( ! (t == 0 && u == 0) ) x86
Memory Model Verification Problem • Safety verification • Does this system reach a bad state • Liveness verification • Does this system repeatedly reach a good state Finite State Machine Finite State Machine Finite State Machine … Memory Model Memory (finite)
Complexity of Memory Model Verification [POPL ‘10] • Formalizes the intuition that SC is easier to program than relaxed memory models
Shared Memory vs Message Passing Decidable Undecidable Finite State Machine Finite State Machine Finite State Machine … Shared Memory Finite State Machine Finite State Machine Finite State Machine … Message Passing Network
Conclusion • Weak consistency comes at a cost of programmability/testability/debuggability • Studying the associated verification problem can quantify this cost • Future: Formalize weak consistency models for the cloud