bug-bash
[Top][All Lists]
Advanced

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

Re: Only store revealed pids in bgpids data structure


From: Chet Ramey
Subject: Re: Only store revealed pids in bgpids data structure
Date: Wed, 15 Apr 2015 21:35:11 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 4/14/15 12:54 AM, John Fremlin wrote:
> Bash instances running in loops get slower over time, as the bgpids data
> structure grows. Here is a small patch to alleviate one issue :)
> 
> The jobs.c:bgpids data structure is used as a cache for the wait syscall,
> to store the status of dead processes, so that scripts can wait on pids
> even multiple times (a bash extension not in POSIX that only allows it once).

Well, and the fact that Posix says the shell is required to remember the
status of the last CHILD_MAX async jobs (though you're right that Posix
says the shell only has to keep track of the statuses until they are
requested and the bash behavior is an extension).

> Some pids cannot ever be waited for in this way because they run in the
> foreground and there is no way to see their process id.

Thanks for the patch, I will install it and we will see how well it does.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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