Zhu Zihao schreef op di 29-03-2022 om 18:13 [+0800]: > IMO the problem is not fork, you can't do anything useful to create > subprocess without fork on *NIX systems. > > fork is allowed to execute in multi-thread environment. It just don't > care about other threads, it's safe and recommended if you only call > execv after fork. > > The problem is, Shepherd is too flexible and people can do so many > things other than fork+exec in the startup of Shepherd service > (unlike > systemd, only create subprocess is allowed). So Shepherd has to be > conservative. > Being conservative is not sufficient. What if, in-between 'fork' and 'exec', some memory is allocated (and hence, in typical 'malloc' implementations, locking happens)? Greetings, Maxime.