1 |
It's mode 2. When appB stops reading, appA will continue writing until |
2 |
the pipe is full (about 4k I believe) at which time appA will block in |
3 |
a write. |
4 |
|
5 |
dcm |
6 |
|
7 |
On 6/14/06, ÕÅí|Îä <zhangweiwu@××××××.com> wrote: |
8 |
> Hello. This might be OT but I am pretty interested in this and being |
9 |
> unlucky not able to find a real in-depth explanation of pipe on the |
10 |
> Internet. |
11 |
> |
12 |
> How does pipe actually work? I mean, when there is a pipe like this: |
13 |
> $ appA | appB |
14 |
> What happen if appA produced output when appB is still busy processing |
15 |
> the data and did not require any data from input? |
16 |
> |
17 |
> possibility 1) as long as appA can get the resource (CPU?), it simply |
18 |
> keep outputing data, and this data is cached in memory, as long as there |
19 |
> is enough memory, and will finally feed to appB when appB finished his |
20 |
> business and begin to accept more data; |
21 |
> |
22 |
> possibility 2) as long as appB stop requiring data, appA is suspended, |
23 |
> the resource goes to appB. appA is only given resource (CPU?) when appB |
24 |
> finished his business and begin to accept more data; |
25 |
> |
26 |
> Which one is true? I know usually 1) and 2) makes no difference to most |
27 |
> users, that's why the detail explanation of "1) or 2)" is so hard to |
28 |
> google out. |
29 |
> |
30 |
> In my case appA gets the data from another host who have very short |
31 |
> timeout settings, appB is used to compress the data obtained from appA. |
32 |
> the compression is very difficult, usually at 30Kbps, the network is |
33 |
> very fast, around 10Mbps. appB compress the data tunck by tunck, if |
34 |
> Linux actually works in mode 2), the network connection is dropped when |
35 |
> the interval of two tuncks of appB compressing data is longer then the |
36 |
> network timeout setting. appA acutally don't know how to restart |
37 |
> connection from where it was dropped, thus understanding this difference |
38 |
> makes sense to me. |
39 |
> |
40 |
> I made several experiements and my appA and appB both works fine, but I |
41 |
> don't dare to share this appA/B to others unless I get the mechnism |
42 |
> understood. |
43 |
> |
44 |
> Thank you in advance. |
45 |
> |
46 |
> -- |
47 |
> gentoo-user@g.o mailing list |
48 |
> |
49 |
> |
50 |
|
51 |
-- |
52 |
gentoo-user@g.o mailing list |