Re: open FIFO blocking with select - high CPU
From: Alex Fraser (me_at_privacy.net)
Date: 10/29/05
- Next message: Tim Roberts: "Re: Microsoft Hatred FAQ"
- Previous message: Mr. Uh Clem: "Re: exec"
- In reply to: dhanks_at_gmail.com: "open FIFO blocking with select - high CPU"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 Oct 2005 17:58:20 +0100
<dhanks@gmail.com> wrote in message
news:1130563913.318686.37090@g14g2000cwa.googlegroups.com...
> I've open(2)ed a FIFO and I'm blocking. I use select(2) to detect if
> there is data to read(2).
>
> I tested my FIFO brain puzzle with:
>
> $ cat /dev/zero > /tmp/FIFO
>
> Which should really put it to work. My problem is that my program is
> using a lot of CPU after I ^C the cat /dev/zero and the program is
> doing nothing but sleeping (blocking) on the select(2). I've also
> placed a ticker above the select(2) to visually ensure that the program
> isn't in an infinite loop.
>
> Again, just to clarify: I understand the the program should use a lot
> of CPU while it is read(2)ing from my stress test with cat /dev/zero,
> but _after_ I have ^C the cat, so that the program is doing nothing at
> all and awaiting more things to read(2), it continually shows high CPU
> usage with ps aux - but the CPU grandually goes back down to normal.
CPU usage is always averaged over a period of time. You'll no doubt find a
similar gradual increase if you start your program first, wait a while (with
it blocked in open()), then execute the cat command above.
Alex
- Next message: Tim Roberts: "Re: Microsoft Hatred FAQ"
- Previous message: Mr. Uh Clem: "Re: exec"
- In reply to: dhanks_at_gmail.com: "open FIFO blocking with select - high CPU"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|