From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: General kernel question about waiting for events
Date: Wed, 2 Dec 2009 00:24:24 +0000 [thread overview]
Message-ID: <20091202002424.1e430662@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <1259712620.23837.22.camel@maxim-laptop>
> In that case, wrapped in different packages, it always ends with
> following loop:
>
> while( event == false )
> schedule();
No. If it were to do that then real time processes could spin eating the
CPU forever.
There is a difference between rescheduling and sleeping for an event.
Sleeping for an event (ie on a waitqueue) means that you will not be
woken until the wait queue is woken (or certain other things like signals
if interruptible). Rescheduling gives the CPU to someone else if anyone
wants it.
In short the different task states that are set are the important bit to
look at to understand this further.
next prev parent reply other threads:[~2009-12-02 0:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 0:10 Maxim Levitsky
2009-12-02 0:24 ` Alan Cox [this message]
2009-12-02 1:28 ` Maxim Levitsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091202002424.1e430662@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®