虚假唤醒:为什么条件变量会"无缘无故"地返回

1974年10月,C.A.R. Hoare在《Communications of the ACM》上发表了一篇题为"Monitors: An Operating System Structuring Concept"的论文。这篇论文奠定了并发编程中monitor和条件变量的理论基础。六年后的1980年2月,Xerox PARC的Butler Lampson和David Redell发表了另一篇关键论文"Experience with Processes and Monitors in Mesa",他们在实践中发现了一个令人不安的现象:被唤醒的线程有时会发现条件并未满足。 ...

9 min · 4410 words