* David Lloyd: > Sure, but I don't really see this as necessary if glibc is already > following the vfork-like path. Another thing to know is that at least > in the 2.26 sources I have checked out, the POSIX_SPAWN_USEVFORK flag > is completely ignored. See also [2].
Right, the manual pages are outdated. For applications, there is never a good reason to use POSIX_SPAWN_USEVFORK because the glibc implementation is either buggy when this flag is used, or the flag does nothing. The bugs may matter to applications using OpenJDK, so I don't think you can set the flag within OpenJDK. So the only thing you can do here is to use posix_spawn *without* POSIX_SPAWN_USEVFORK, and advise OS vendors to backport the glibc changes if they have customers that are impacted by the lack of process creation performance (or OOM during process creation). Another possibility would be to emulate what glibc's fixed, fork-based posix_spawn does, but this requires writing some machine code (for vfork/clone) and issuing direct system calls to bypass some abstractions in glibc (for setprocmask). > [2] > https://github.com/bminor/glibc/commit/ccfb2964726512f6669fea99a43afa714e2e6a80 Note that this neither the canonical glibc source code location, nor is the code actually used on Linux. 8-) Thanks, Florian