OSTEP / Concurrency-CV


条件变量在实现上可以看做futex + queue. 这个queue里面存储是因为等待这个condition而阻塞的线程

A condition variable is an explicit queue that threads can put themselves on when some state f execution (i.e., some condition) is not as desired (by waiting on the condition); some other thread, when it changes said state, can then wake one (or more) of those waiting threads and thus allow them to continue (by signaling on the condition).

Tom West's Law. 不是所有事情都值得做好的

TIP: DON’T ALWAYS DO IT PERFECTLY (TOM WEST’S LAW) Tom West, famous as the subject of the classic computer-industry book Soul of a New Machine [K81], says famously: “Not everything worth doing is worth doing well”, which is a terrific engineering maxim. If a bad thing happens rarely, certainly one should not spend a great deal of effort to prevent it, particularly if the cost of the bad thing occurring is small. If, on the other hand, you are building a space shuttle, and the cost of something going wrong is the space shuttle blowing up, well, perhaps you should ignore this piece of advice