Re:Why Ruby App Servers Break on MacOS High Sierra
by throwaway613834 on Thursday October 19, 2017 @05:56AM
(#15506657)
fork() fundamentally does not make sense as the de-facto method of starting a new process. Why aren't people using posix_spawn() by default?
[ Parent
| on HN ]
Re:Why Ruby App Servers Break on MacOS High Sierra
by tedunangst on Thursday October 19, 2017 @06:58AM
(#15506878)
Because that doesn't share memory.
Re:Why Ruby App Servers Break on MacOS High Sierra
by twic on Thursday October 19, 2017 @08:24AM
(#15507257)
You can share memory in other ways, via mmap or SysV shared memory.
You could imagine an implementation of the Ruby interpreter which kept all the expensive and shareable state (bytcode and class metadata, i suppose) in a shared memory segment, and used spawning to create worker processes with their own process heaps, but sharing that segment.
It would be a lot of work to implement. It would probably be easier just to get Ruby to use threads properly.
Re:Why Ruby App Servers Break on MacOS High Sierra
by bpicolo on Thursday October 19, 2017 @09:40AM
(#15507754)
> bytcode and class metadata
There's a bit more to it than that, as programs can run code and load data prefork. Pretty important for things like large config files.
Re:Why Ruby App Servers Break on MacOS High Sierra
by segmondy on Thursday October 19, 2017 @09:45AM
(#15507788)
implementation of fork is defined by the POSIX standards. Apple should respect it. There are tons of apps that have been written using fork, are you going to change all of them to use posix_spawn()?
Re:Why Ruby App Servers Break on MacOS High Sierra
by tedunangst on Thursday October 19, 2017 @10:55AM
(#15508438)
Posix standard says you can't call anything but async functions after fork() in a threaded program. Application developers should respect that.