[PLUG] high cpu utilization

Aditya Godbole aag.lists at gmail.com
Fri Nov 13 17:27:15 IST 2009


On Fri, Nov 13, 2009 at 12:01 PM, Abhijit Bhopatkar
<bain at devslashzero.com> wrote:
>
>> Create a pipe. Write data into that pipe from thd_r. In thd_w, you can
>> do a blocking read on the pipe.
>
> No, you don't want to do that,
> Passing data around pipes is expensive, you might as well busy spin in write
> thread. (yes there is always a splice syscall to do a zero copy op, but its
> complicated and not needed, all we need here is a conditional variable).

How is a busy spin better than a blocking read on a pipe? Also, since
he is streaming, he needs a 'stream' (perhaps eventually, the write
may not be so fast?). Either he would have to implement buffer
management to get the desired stream functionality or go for something
like a pipe.

-aditya




More information about the Plug-mail mailing list