Question about libjava/childproc.c
Martin Buchholz
martinrb at google.com
Sun Sep 9 17:38:41 UTC 2018
On Sun, Sep 9, 2018 at 1:04 AM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:
> On 09/09/2018 01:34, Martin Buchholz wrote:
>
> :
>
> See discussion in src/java.base/unix/native/libjava/ProcessImpl_md.c
>
>
>> Later Oracle introduced something very similar with the jspawnhelper.
>> But I see that jspawnhelper is not used at all for the vfork() case,
>> just for posix_spawn(), yes?
>>
>
> Implemented by other folks. I was mostly happy with vfork. I forget the
> motivation to introduce jspawnhelper, but I'm sure it's in the fossil
> record somewhere!
>
> jpsawnhelper is to deal with chdir and threading issues that arise when
> using posix_spawn. The move to posix_spawn was motivated by eager
> allocation of swap when using fork. It was originally done for Solaris,
> then macOS, and I see the AIX implementation is declared to use posix_spawn
> too. Linux is using vfork and seems to be stable. Martin will probably
> remember a brief foray into clone(CLONE_VM) at one point but that didn't
> work out.
>
Thanks. I followed my own advice and re-read the comments in
ProcessImpl_md.c.
I now recall not paying full attention to the posix_spawn implementation
because I use Linux exclusively, where "my" vfork implementation works well.
It seems too late to add HP-UX support to OpenJDK, but if SAP are willing
to do the porting work I would support it (why didn't HP do it decades
ago?). One decision to make for any Unix platform is which process
implementation strategy to use.
More information about the core-libs-dev
mailing list