我正在阅读“Robert的Linux内核开发第三版”,以了解Linux内核是如何工作的。(2.6.2.3)
我对等待队列的工作方式感到困惑,例如,下面的代码:
/* ‘q’ is the wait queue we wish to sleep on */
DEFINE_WAIT(wait);
add_wait_queue(q, &wait);
while (!condition) { /* condition is the event that we are waiting for */
prepare_to_wait(&q, &wait, TAS
我对互斥锁持怀疑态度。
Global mutex;
/// more things
Acquire lock on mutex;
/// Do things here;
Release lock;
如果线程获得互斥锁(例如,tbb互斥锁),它是否可以在持有锁的同时被处理器休眠并在稍后唤醒以完成作业,或者当线程获得互斥锁的锁时,它会不间断地继续工作,直到释放锁为止?