2 ms·
That's relatively non-problematic: setup everything you need, fork(), exec() or _exit(). But there's lots of other issues. Things like PID number reuse, libra
by cryptonector 9y ago
That's relatively non-problematic: setup everything you need, fork(), exec() or _exit().
But there's lots of other issues. Things like PID number reuse, libraries in single-threaded programs that may need to reinitialize on fork() (via pthread_atfork()? no because fork() might have been called directly via syscall() or by trapping from asm code, bypassing the C library altogether), and so on.
Just use posix_spawn().
EDIT: Also, ultimately, the worst thing about fork() is that it can't possibly be high-performance. Either fork() copies the writable parts of the address-space, or sets up COW, or copies the RSS and sets up COW for the rest. Well, on modern CPUs COW is really expensive. And copying a JVM is no fun either.
- deleted 9y ago[deleted]