链表插入到一半时崩溃
原片 00:51:30—00:53:31
把 y insert 到 x 后,令 n 等于 x 的 next,需要依次修改多个指针:x 的 next 等于 y,y 的 previous 等于 x,n 的 previous 等于 y,y 的 next 等于 n。并发时会在前后加 lock、unlock,防止 data race。
但若线程突然被杀呢?crash consistency 就像执行流随时消失。图里有 x、new、y,先把 x 的 next 改为 y,y 的 previous 改为 x,再把 n 的 previous 改为 y。
这时 y 的 next 仍为空,系统或线程突然 crash。原计划写 1、2、3、4,却没全做完,数据结构就进入 inconsistent 状态。

y 的 next 指向零,遍历时就会 crash。只有全部更新完成,结构才 consistent。文件系统写内容也会遇到类似情况。