4 ms·
GC usually runs on a separate thread right? Isn't it true you shouldn't run fork() when you have a multithreaded program?
by sebazzz 8y ago
GC usually runs on a separate thread right? Isn't it true you shouldn't run fork() when you have a multithreaded program?
- chrisseaton 8y agoNot usually. Only an advanced GC will be concurrent. Something like Perl or Ruby for example runs in the foreground. If it is concurrent then you shut down the GC thread, fork, and then start a new thread in each new process.
- romeisendcoming 8y agoIt's probably not safe to fork() from most frameworks threads (OpenMP) and is hard to make safe for complicated parallel processing. But if you control the flow of execution and minimize mutex and critical section(s) it can be done withal. Several examples of thread served queues performing user defined actions upon message receipt to include fork() + exec() come to mind.