[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with time package, struct rusage and wait3
From: |
Igor Khavkine |
Subject: |
Re: Problem with time package, struct rusage and wait3 |
Date: |
Wed, 1 Aug 2001 01:48:08 -0400 |
User-agent: |
Mutt/1.3.18i |
On Wed, Aug 01, 2001 at 01:05:18AM -0400, Roland McGrath wrote:
> I cut down the CC list, because this has nothing to with debian.
>
>
> > On Tue, Jul 31, 2001 at 03:11:00PM -0400, Roland McGrath wrote:
> > > You are mistaken; sysdeps/unix/bsd/bsd4.4/wait3.c is used.
> >
> > You're right. Now I definitely know that I shouldn't post any
> > patches before noon.
>
> :-) Sorry I didn't elaborate more this morning; I didn't have time to
> write much then.
>
> There is no mystery here. rusage has been a known missing feature for a
> very long time. It can't be done properly without microkernel changes to
> support it. As you can see in getrusage.c, the microkernel maintains the
> right statistics at the task level and that's all that's needed for
> RUSAGE_SELF (which is implemented).
>
> The problem for wait4 is that the kernel does not record these statistics
> anywhere but the task data structures, and so the data is lost as soon as
> the Mach task terminates. The work in proc is quite simple: it needs to
> record this info when a task dies so it can return it for proc_wait, and
> add it into a sum of the parent's dead children that can be returned by a
> new proc RPC that RUSAGE_CHILDREN would use. None of that work has been
> done because it is all trivial, and useless until the kernel has the
> feature to notify proc.
I was under the impression that, under normal UNIX semantics, if
a process fork()'s a child process, then when the child terminates
it will either receive a signal (SIGCHLD) or it's its call to
waitX() will return. In Hurd both of these events are coordinated
through proc. Are you saying that, it is possible for a task to
terminate without one of the above two events occuring, thus
not notifying proc?
> If you are interested in adding this functionality to the kernel, that
> would be great. (It has been an item on the tasks list for a long time,
> albeit with an oblique description that doesn't suggest this is what is
> needed for rusage.) But you probably should take on some other Hurd work
> before tackling this. If you do want to go at it, then talk with us about
> the specifics before you get started.
I've got plenty on my plate at the moment. :-) But as food for thought,
what kind of change would be involved? something like a "notify me,
when you terminate" port in the kernel taks strucure?
Also, if we are talking about modifying the microkernel, is it worth
considering modifying `struct task_basic_info' or adding another kind
of task_info struct to get more statistal data from the kernel?
Igor