On Mon, 29 Jul 2019 23:37:34 +0530, Muni Sekhar said: > On Mon, Jul 29, 2019 at 11:31 PM Bharath Vedartham wrote: > > Sorry to spoil the fun here. But check out what the queue data structure > > is all about. 'wait_queue' :) > A wait queue is a doubly linked list of wait_queue_t structures that > hold pointers to the process task structures of the processes that are > blocking. Each list is headed up by a wait_queue_head_t structure, > which marks the head of the list and holds the spinlock to the list to > prevent wait_queue_t additional race conditions So... if you're picking the first entry off a linked list, how do you ensure that the one you want run is the one that gets picked? Make sure the right one is at the head of the list, of course. ;)