1 |
On 14 June 2006 14:12, 张韡武 wrote: |
2 |
> Hello. This might be OT but I am pretty interested in this and being |
3 |
> unlucky not able to find a real in-depth explanation of pipe on the |
4 |
> Internet. |
5 |
> |
6 |
> How does pipe actually work? I mean, when there is a pipe like this: |
7 |
> $ appA | appB |
8 |
> What happen if appA produced output when appB is still busy processing |
9 |
> the data and did not require any data from input? |
10 |
> |
11 |
> possibility 1) as long as appA can get the resource (CPU?), it simply |
12 |
> keep outputing data, and this data is cached in memory, as long as there |
13 |
> is enough memory, and will finally feed to appB when appB finished his |
14 |
> business and begin to accept more data; |
15 |
> |
16 |
> possibility 2) as long as appB stop requiring data, appA is suspended, |
17 |
> the resource goes to appB. appA is only given resource (CPU?) when appB |
18 |
> finished his business and begin to accept more data; |
19 |
> |
20 |
> Which one is true? I know usually 1) and 2) makes no difference to most |
21 |
> users, that's why the detail explanation of "1) or 2)" is so hard to |
22 |
> google out. |
23 |
|
24 |
Neither nor. ;-) |
25 |
|
26 |
It's called "blacking IO". An app that has to wait for IO (whether it's |
27 |
reading or writing doesn't matter) doesn't get CPU until the IO resource is |
28 |
ready. Of course, the scheduler in your kernel can take your app off the CPU |
29 |
for other reasons even if the resource is ready. |
30 |
|
31 |
Uwe |
32 |
|
33 |
-- |
34 |
Mark Twain: I rather decline two drinks than a German adjective. |
35 |
http://www.SysEx.com.na |
36 |
-- |
37 |
gentoo-user@g.o mailing list |