[RFC] Fix PosixProcess by porting VMProcess from Classpath...
David Daney
ddaney@avtrex.com
Wed Jul 14 16:14:00 GMT 2004
Andrew Haley wrote:
> Bryce McKinlay writes:
> > Andrew Haley wrote:
> >
> > >Bryce McKinlay writes:
> > > > David Daney wrote:
> > > >
> > > > >It is said that:
> > > > >
> > > > >http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
> > > > >
> > > > >Could be fixed by using VMProcess from Classpath instead of the current
> > > > >PosixProcess.
> > > > >
> > > > >There are several other problems that I have been experiencing related
> > > > >to not reaping terminated or failed Processes that would also be fixed.
> > > > >
> > > > >
> > > > >Q1: Does this seem like a good idea?.
> > > > >
> > > > >
> > > >
> > > > Yes. If the general opinion is that Classpath's VMProcess is better than
> > > > ours, then I am in favour of switching to/merging with the classpath
> > > > version.
> > >
> > >Well, obviously that's true. However, we might also break things with
> > >this change, so we need really to be convinced that it is better in
> > >all respects. Having a single base implementation seems like a good
> > >this, certainly.
> > >
> > Our Process implementation is broken by design (see PR 11801), so
> > its pretty clear that a rewrite is required. Given that, we might
> > as well start with an existing implementation - and if this means
> > another class can be merged with Classpath, then all the better.
>> I agree. However, I'd be interested to know if Classpath's
> implementation of Process is stable and if anyone has ever used it for
> anything much. Forewarned is forearmed, as they say.
One thing I don't like about Classpath's VMProcess is that it polls for
terminated processes.
I was initially thinking about having the process forking thread be
blocking in waitpid() most of the time. Whenever a new Process was
needed, a signal would be sent to the forking thread to terminate the
waitpid() call.
The issues I had in my mind about this approach were:
1) Which signal to use.
2) I know I could make it work under the Linux kernel, but cannot test
on other Posix environments.
3) One would have to be careful about avoiding race conditions.
David Daney.
More information about the Java
mailing list