public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Uwe Thiem <uwix@iway.na>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] how does a pipe work? Which process wait for which one, or they don't actually wait each other?
Date: Wed, 14 Jun 2006 14:28:29 +0100	[thread overview]
Message-ID: <200606141428.29861.uwix@iway.na> (raw)
In-Reply-To: <1150290735.8524.12.camel@joe.realss>

On 14 June 2006 14:12, 张韡武 wrote:
> Hello. This might be OT but I am pretty interested in this and being
> unlucky not able to find a real in-depth explanation of pipe on the
> Internet.
>
> How does pipe actually work? I mean, when there is a pipe like this:
> $ appA | appB
> What happen if appA produced output when appB is still busy processing
> the data and did not require any data from input?
>
> possibility 1) as long as appA can get the resource (CPU?), it simply
> keep outputing data, and this data is cached in memory, as long as there
> is enough memory, and will finally feed to appB when appB finished his
> business and begin to accept more data;
>
> possibility 2) as long as appB stop requiring data, appA is suspended,
> the resource goes to appB. appA is only given resource (CPU?) when appB
> finished his business and begin to accept more data;
>
> Which one is true? I know usually 1) and 2) makes no difference to most
> users, that's why the detail explanation of "1) or 2)" is so hard to
> google out.

Neither nor. ;-)

It's called "blacking IO". An app that has to wait for IO (whether it's 
reading or writing doesn't matter) doesn't get CPU until the IO resource is 
ready. Of course, the scheduler in your kernel can take your app off the CPU 
for other reasons even if the resource is ready.

Uwe

-- 
Mark Twain: I rather decline two drinks than a German adjective.
http://www.SysEx.com.na
-- 
gentoo-user@gentoo.org mailing list



  reply	other threads:[~2006-06-14 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14 13:12 [gentoo-user] how does a pipe work? Which process wait for which one, or they don't actually wait each other? 张韡武
2006-06-14 13:28 ` Uwe Thiem [this message]
2006-06-14 14:15 ` Devon Miller
2006-06-14 16:38 ` Boyd Stephen Smith Jr.

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=200606141428.29861.uwix@iway.na \
    --to=uwix@iway.na \
    --cc=gentoo-user@lists.gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox