From: Manfred Spraul <manfred@colorfullife.com>
To: haakon.riiser@fys.uio.no
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Fw: Re: Busy-wait delay in qmail 1.03 after upgrading to Linux 2.6
Date: Tue, 20 Jan 2004 19:33:17 +0100 [thread overview]
Message-ID: <400D746D.7030409@colorfullife.com> (raw)
In-Reply-To: <20040120021353.39e9155e.akpm@osdl.org>
Haakon Riiser <haakon.riiser@fys.uio.no> wrote:
>What Qmail did was basically to use a named pipe as a trigger,
>where one program select()s on the FIFO file descriptor, waiting
>for another program to write() the FIFO. Once select() returns,
>the listener close()s the FIFO (the data was not important,
>it was only used as a signal), does some work, then re-open()s
>the FIFO file, and ends up in the same select() waiting for the
>whole thing to happen again.
>
What drains the fifo?
As far as I can see the fifo is filled by the write syscalls, and
drained by chance if both the reader and the writer have closed their
handles.
> for (;;) {
> while ((fd = open("test.fifo", O_WRONLY | O_NONBLOCK)) < 0)
> ;
> gettimeofday(&tv1, NULL);
> if (write(fd, &fd, 1) == 1) {
>
xxx now a thread switch
> gettimeofday(&tv2, NULL);
> fprintf(stderr, "dt = %f ms\n",
> (tv2.tv_sec - tv1.tv_sec) * 1000.0 +
> (tv2.tv_usec - tv1.tv_usec) / 1000.0);
> }
> if (close(fd) < 0) {
> perror("close");
>
>
If a thread switch happens in the indicated line, then the reader will
loop, until it's timeslice expires - one full timeslice delay between
the two gettimeofday() calls.
Running the reader with nice -20 resulted in delays of 200-1000 ms for
each write call, nice 20 resulted in no slow calls. In both cases 100%
cpu load.
--
Manfred
next parent reply other threads:[~2004-01-20 18:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040120021353.39e9155e.akpm@osdl.org>
2004-01-20 18:33 ` Manfred Spraul [this message]
2004-01-20 19:22 ` Busy-wait delay in qmail 1.03 after upgrading to Linux 2.6 Haakon Riiser
2004-01-20 19:45 ` Mike Fedyk
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=400D746D.7030409@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=haakon.riiser@fys.uio.no \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.