知识卡片
读写闩与等待队列
对页的读读可共享,写写与读写需要排他,页装入仍需防止两个线程重复执行。等待可阻塞并让出处理器,也可短暂自旋。队列锁可用 CAS 原子挂队,每个等待者只监听其前驱控制的状态,避免所有线程争抢同一个状态变量。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · Locks
原书出处 · 1 处
- Chapter 5. Transaction Processing and Recovery Locks · 查看原书依据
An RW lock allows multiple readers to access the object concurrently, and only writers (which we usually have fewer of) have to obtain exclusive access to the object. Figure 5-7 shows the compatibility table for readers-writer locks:
参考来源
- 位置:《Database Internals》Chapter 5. Transaction Processing and Recovery(book-source:extracted/Database Internals A deep-dive into how distributed data systems work (Alex Petrov)/_epub-src/OEBPS/ch05.html#readers_writers_locks,段 231)
- 结论依据:第 229–238 段说明兼容性、等待方式和 CAS 排队。
- 原始内容:An RW lock allows multiple readers to access the object concurrently, and only writers (which we usually have fewer of) have to obtain exclusive access to the object. Figure 5-7 shows the compatibility table for readers-writer locks: