Re: Parallelization of syscmd

Douglas McIlroy <[email protected]> Fri, 19 Sep 2025 09:38:20 -0400
Newsgroups gmane.comp.gnu.m4.general
Message-ID <CAKH6PiWk1CdXh0VoLB8a4s1+rgJ1b0x-viwbF5RmuWfBh-0vTw@mail.gmail.com>
Isn't parallel operation of syscmd already available via the shell's & oper=
ator?

Doug

On Fri, Sep 19, 2025 at 9:12=E2=80=AFAM Eric Blake <[email protected]> wrot=
e:
>
> On Thu, Sep 18, 2025 at 06:37:38PM -0300, Bento Borges Schirmer wrote:
> > Hey,
> >
> > I don't really know how m4 works. That's just an idea that occurred to
> > me. I think m4 could keep expanding macros and processing text while a
> > syscmd() is in flight, potentially having several syscmd() executing
> > at once. The user would have to guarantee that the syscmd() execution
> > is "pure", that is, that one command does not depend on side effects
> > of previous executions. All that could be enabled by some flag, like
> > -j which reminisces Makefile.
>
> You are welcome to try and write such a patch.  But currently m4 is
> single-threaded; what you are proposing would be a massive redesign,
> in order to handle parallel threads and possible speculative execution
> followed by rollback if the syscmd was not pure after all.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.
> Virtualization:  qemu.org | libguestfs.org
>
>