wait_event()\ wait_event_interruptible()\ wait_event_interruptible_timeout() and wake_up()

Greg KH greg at kroah.com
Tue Aug 6 08:26:40 EDT 2019


On Tue, Aug 06, 2019 at 05:30:43PM +0530, Muni Sekhar wrote:
> On Tue, Aug 6, 2019 at 5:12 PM Valdis Klētnieks <valdis.kletnieks at vt.edu> wrote:
> >
> > On Tue, 06 Aug 2019 14:15:53 +0530, Muni Sekhar said:
> >
> > > If they do different things, does the waiting threads wakeup order is
> > > the same in which they were enqueued (FIFO order)?
> >
> > You missed the point - if you have (for example) something that's waiting for
> > mouse I/O and something that's waiting for a network packet, under what
> > conditions will they be using the same wait event?
> In this example they won't wait on the same wait event. Let us
> consider buggy code is written like that and more than one
> process(they do different things) waiting on the same wait event which
> process gets woken up? Is the process at the head of the list?

Again, try it and see, it is trivial to do this test.

Also, when you write buggy code, you get buggy results :)

thanks,

greg k-h



More information about the Kernelnewbies mailing list