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 1FqWIu-0001YN-7Q for garchives@archives.gentoo.org; Wed, 14 Jun 2006 14:25:08 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.6/8.13.6) with SMTP id k5EEMu7c001320; Wed, 14 Jun 2006 14:22:56 GMT Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.202]) by robin.gentoo.org (8.13.6/8.13.6) with ESMTP id k5EEFwIj005457 for ; Wed, 14 Jun 2006 14:15:59 GMT Received: by wx-out-0102.google.com with SMTP id s18so95843wxc for ; Wed, 14 Jun 2006 07:15:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S52K2aiYEMUKl+vvzuhYZgX4hytu1hgwapDMaUNz8r6SDX/5iw2U1KpgKqFg4gKnTGWzBerx4h41SuHsgmKFSfu/Nmr3cDpExcC1i0VAE4rGOqNPXjuWw2L3Gf95H/Lh7vAIvHhqxUAboFmxQsJemvbthQpxuxEQdNLVBnUmWbI= Received: by 10.70.11.8 with SMTP id 8mr826732wxk; Wed, 14 Jun 2006 07:15:58 -0700 (PDT) Received: by 10.70.97.6 with HTTP; Wed, 14 Jun 2006 07:15:57 -0700 (PDT) Message-ID: Date: Wed, 14 Jun 2006 10:15:57 -0400 From: "Devon Miller" 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? 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=GB2312; format=flowed Content-Disposition: inline References: <1150290735.8524.12.camel@joe.realss> X-MIME-Autoconverted: from base64 to 8bit by robin.gentoo.org id k5EEFwIj005457 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id k5EEMu7t001320 X-Archives-Salt: 5a5a6d14-329d-42eb-a47c-2cd90970cb07 X-Archives-Hash: 19d55dce07737a38c8e89888da644fb8 It's mode 2. When appB stops reading, appA will continue writing until the pipe is full (about 4k I believe) at which time appA will block in a write. dcm On 6/14/06, =D5=C5=ED|=CE=E4 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. > > In my case appA gets the data from another host who have very short > timeout settings, appB is used to compress the data obtained from appA. > the compression is very difficult, usually at 30Kbps, the network is > very fast, around 10Mbps. appB compress the data tunck by tunck, if > Linux actually works in mode 2), the network connection is dropped when > the interval of two tuncks of appB compressing data is longer then the > network timeout setting. appA acutally don't know how to restart > connection from where it was dropped, thus understanding this differenc= e > makes sense to me. > > I made several experiements and my appA and appB both works fine, but I > don't dare to share this appA/B to others unless I get the mechnism > understood. > > Thank you in advance. > > -- > gentoo-user@gentoo.org mailing list > > --=20 gentoo-user@gentoo.org mailing list