From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1FqXeS-0002mb-6V for garchives@archives.gentoo.org; Wed, 14 Jun 2006 15:51:28 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.6/8.13.6) with SMTP id k5EFnoEH031519; Wed, 14 Jun 2006 15:49:50 GMT Received: from smtp1.iway.na (smtp1.iway.na [196.44.136.15]) by robin.gentoo.org (8.13.6/8.13.6) with ESMTP id k5EFeZlc012334 for ; Wed, 14 Jun 2006 15:40:36 GMT Received: from vscan.iway.na (vscan.iway.na [196.44.136.13]) by smtp1.iway.na (Postfix) with ESMTP id 17A23B765C for ; Wed, 14 Jun 2006 16:40:35 +0100 (WAT) Received: from mx2.iway.na (localhost [127.0.0.1]) by vscan.iway.na (Postfix) with ESMTP id A1B0775343 for ; Wed, 14 Jun 2006 16:40:33 +0100 (WAT) Received: from uwix.alt.na ([196.44.156.198]) by mx2.iway.na (Netscape Messaging Server 4.15) with ESMTP id J0UWVL03.651 for ; Wed, 14 Jun 2006 16:40:33 +0100 Received: from uwe by uwix.alt.na with local (Exim 4.61) (envelope-from ) id 1FqVQ5-0002A3-Vy for gentoo-user@lists.gentoo.org; Wed, 14 Jun 2006 14:28:29 +0100 From: Uwe Thiem Organization: SysEx (Pty) Ltd. 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 User-Agent: KMail/1.9.1 References: <1150290735.8524.12.camel@joe.realss> In-Reply-To: <1150290735.8524.12.camel@joe.realss> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Message-Id: <200606141428.29861.uwix@iway.na> Sender: Uwe Thiem Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id k5EFnoEY031519 X-Archives-Salt: 814d00c5-81b0-4985-bdfa-64af49a16e12 X-Archives-Hash: 36e4d1e6fb227df5f45621499559f3b6 On 14 June 2006 14:12, =E5=BC=A0=E9=9F=A1=E6=AD=A6 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 ther= e > 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=20 reading or writing doesn't matter) doesn't get CPU until the IO resource = is=20 ready. Of course, the scheduler in your kernel can take your app off the = CPU=20 for other reasons even if the resource is ready. Uwe --=20 Mark Twain: I rather decline two drinks than a German adjective. http://www.SysEx.com.na --=20 gentoo-user@gentoo.org mailing list