incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <abl...@roguewave.com>
Subject Re: incorrect runtimes
Date Fri, 22 Sep 2006 21:34:02 GMT
Greetings all.

One other observation that can be made is that grandchild process times 
are included if an application terminates in a normal manner.  If this 
were not true, the user and system times would be near 0 for the locale 
tests.

A likely reason this is the case is if the child process waits on those 
grandchild processes, either directly (using wait() and waitpid()), or 
indirectly (using system()).

I suspect a better description of the time values returned for platforms 
other than Solaris would be 'times for all immediate children, plus 
times for all descendants who have been waited upon by their parent 
processes.'  It should be possible to alter the test case to confirm or 
deny this hypothesis, but would involve wait()ing for terminated 
grandchild processes in the child process, prior to the child process 
being killed.

Attached is a refinement of the version C of the patches I sent to the 
list earlier.  The main changes in this version are a refinment on the 
handling of kill failures and correction of a pair of off-by one errors.

--Andrew Black

Log:
	* exec.cpp [!_WIN32 && !WIN64] (wait_for_child): Evaluate return value 
when sending signals to child process group, correct off-by-one issue 
when checking for end of signal array, Try to kill off any grandchildren 
left in the child process group after the child process terminates.

Martin Sebor wrote:
> Martin Sebor wrote:
>> I took a closer look at the output produced by my little test program
>> (after making a small change to it where I moved the sleep(1) call in
>> the parent branch immediately above the waitpid call). Here's the
>> behavior I have observed on each of the following operating systems:
>>
> 
> Here's a corrected interpretation of the results (the corrected
> program is attached):
> 
> AIX:      only immediate children's times are returned
> HP-UX:    only immediate children's times are returned
> IRIX 6.5: only immediate children's times are returned
> Linux:    only immediate children's times are returned
> Solaris:  cumulative times of children and all their
>           descendants are returned
> Tru64:    only immediate children's times are returned
> 
> I was misled by the rapidly decreasing user times in test runs
> that created increasing numbers of grandchildren. The decreasing
> numbers actually make sense since more processes compete for the
> CPU and thus get to use it less time (with the OS spending more
> of its own time switching between them).
> 
> So I guess the only odd duck is Solaris which accumulates the
> time used up by the child's children's despite the fact that
> they were never waited on.
> 
> Martin

Mime
View raw message