[Mono-dev] fork() in Mono

Gene Thomas gene at genethomas.com
Mon Dec 4 01:23:34 UTC 2017


Hello,

I have noticed that in mono/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs
<https://github.com/mono/mono/blob/master/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs>
 fork() is #if'd out with the message "*DO NOT directly call fork(2); it
bypasses essential shutdown code. Use System.Diagnostics.Process instead*".

What happens specifically? fork() starts a process, it does not shut
anything down? fork() should just work, does it not (effectively (copy on
write)) copy the entire VM which then each shuts down independently?
fork() does
work in Python on Unix (multiprocessing module).

fork() is powerful, it supports using processes as an alternative to
threads. One can not test for a one in a million race condition.
System.Diagnostics.Process only replaces fork() then exec(). I wish to use
fork() to support replicated processes, starting with a complete copy of
the application's state greatly simplifies this.

Thanks,


Gene Thomas.

+64 21 436384 <+64%2021%20436%20384>
gene at genethomas.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20171204/d59f3941/attachment.html>


More information about the Mono-devel-list mailing list