On Thu, May 16, 2019 at 11:37 PM Nicolas Koenig <koeni...@student.ethz.ch> wrote: > > Hi everyone, > > a quick heads up, that the native coarray patch I'm working on at the > moment (1200 loc and growing :D) will be based upon forked processes, so > we won't be able to eliminate fork().
I would guess that's a case where fork semantics are useful, as presumably copying the memory of a process is exactly what you want. posix_spawn() is a replacement for some common uses of fork+exec. > P.S.: About the paper: A microsoft guy who doesn't like fork()? Color me > surprised :D Well, it's one author out of four. And it's Microsoft Research, which does serious CS research, not PR department vomit. The paper does make some good points, and it's worth reading. As an interesting aside, the original libgfortran IO library was based upon a paper by one of the authors of this paper. One of my first contributions to GFortran back in the day was ripping out that. > > > On 16/05/2019 22:10, Janne Blomqvist wrote: > > On Thu, May 16, 2019 at 10:59 PM Thomas Koenig <tkoe...@netcologne.de> > > wrote: > >> > >> Hi Janne, > >> > >>> fork() semantics can be problematic. Most unix style OS'es have > >>> posix_spawn which can be used to replace fork + exec in many cases. > >>> For more information see > >>> e.g. > >>> https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.pdf > >>> > >>> This replaces the one use of fork in libgfortran with posix_spawn. > >> > >> Do I understand the patch correctly that we would no longer use fork() > >> if posix_spawn is not available? I think we should leave that in as > >> a fallback option. > > > > Yes. But there is already a fallback in case posix_spawn (or > > previously, fork) is not available, namely falling back to synchronous > > behavior. Since this is anyway somewhat of a corner case (namely, with > > wait=.false.), and posix_spawn is supported on all (well, at least > > Linux, macOS, *BSD, cygwin, Solarix, AIX) remotely modern unix type > > systems, a further fallback to fork() is IMHO not warranted. > > > > -- Janne Blomqvist