Cooperating Threads, Synchronization
Real Problems
ATM Bank Server

Event Driven Version of ATM Server
Cooperating Threads Version of ATM Server

Therac-25

Problem is at the lowest level


Atomic Operations:an operation that always runs to completion or not at all
Too Much Milk

方案一:使用便利贴 ❌
方案二:先留便利贴,再检查牛奶 ❌
方案三:每个人使用自己特有的便利贴 ❌

方案四:每个人使用自己特有的便利贴2 ✅

方案五:使用锁 ✅
Implement Higher Level Synchronization Primitives: Lock

How to implement Locks
Interrupts



Atomic Read-Modify-Write Instructions
Implementing Locks With test&set
参考
Last updated