知识卡片
共享部件加锁造成循环等待
原书继续追问部件价格变化是否会影响采购单,于是试着同时锁采购单和共享部件。不同人操作不同采购单却使用同一部件,会因共享部件锁而互相阻塞;图6.9–6.10中一人持有长号锁、等待小提琴,另一人持有小提琴锁、等待长号,形成循环等待。根因是把跨采购单共享且高争用的部件纳入即时锁定范围。对应方案见[[行项保存成交价降低争用]]。
结构图:
flowchart LR
George["George:持有长号部件锁"] -->|等待小提琴部件锁| Amanda["Amanda:持有小提琴部件锁"]
Amanda -->|等待长号部件锁| George
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第06章|Aggregates · 查看原书依据
Consider that "part." If someone changed the price of a trombone while Amanda was adding to her order, wouldn't that violate the invariant too? Let's try locking the part in addition to the entire PO. Here's what happens when George, Amanda, and Sam are working on different POs: Figure 6.9. Over-cautious locking is interfering with people's work. The inconvenience is mounting, because there is a lot of contention for the instruments (the "parts"). And then: Figure 6.10. Deadlock Those three will be waiting a while. At this point we can begin to improve the model by incorporating the following knowledge of the business: Parts are used in many POs (high contention).