bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


From: Juha Markkula
Subject: (no subject)
Date: Mon, 17 Nov 2003 01:23:10 +0200 (EET)

Hello


If you run for example this command in bash:

for ((i=0;i<100;i++));do echo $i;done|gawk '{ ("echo " $1 )|getline \
foo;system("sleep 1");print foo }'

and then look at your processes, you will see that there is increasing
amount of defunct sh child processes for gawk.

...
20738 ?        00:00:02   xterm
20739 pts/2    00:00:00     bash
13377 pts/2    00:00:00       gawk
13378 pts/2    00:00:00         sh <defunct>
13380 pts/2    00:00:00         sh <defunct>
13383 pts/2    00:00:00         sh <defunct>
13385 pts/2    00:00:00         sh <defunct>
13387 pts/2    00:00:00         sh <defunct>
13389 pts/2    00:00:00         sh <defunct>
13391 pts/2    00:00:00         sh <defunct>
13393 pts/2    00:00:00         sh <defunct>
13395 pts/2    00:00:00         sh <defunct>
13397 pts/2    00:00:00         sh <defunct>
13399 pts/2    00:00:00         sh <defunct>
13401 pts/2    00:00:00         sh <defunct>
13403 pts/2    00:00:00         sh <defunct>
13405 pts/2    00:00:00         sh <defunct>
13407 pts/2    00:00:00         sh <defunct>
13409 pts/2    00:00:00         sh <defunct>
13410 pts/2    00:00:00         sleep
...

In one of my programs I have to use awk's "command"|getline -construct in
this way and fork() stops working for gawk after a while because process
table fills up. My solution has been using mawk which does clear it's
returned child processes (wait() for them perhaps) at least at some time
intervals. If I run the example above using mawk it does not have more
than one defunct process at a time.

I'm using Debian 3.0 for i386 Linux kernel 2.4.22
gawk version is 3.1.0, the one that came with the Debian
mawk version is 1.3.2

Juha Markkula




reply via email to

[Prev in Thread] Current Thread [Next in Thread]