exAspArk
exAspArk
Aug 26, 2017 · 1 min read

Hey!

> I’d love to see an explanation why it’s so much more expensive in Ruby.

Linux fork does a lot of things: getting a new PID, getting the code from parent’s process, duplicating heap, stack, initializing data and virtual memory which uses parent’s physical memory with Copy-on-Write, resetting utilization and CPU time counters, etc. In the article you mentioned above, creating 100 threads takes 7.8ns, while creating 100 processes takes 18ns. So, it’s more than 2x slower.

Wow, thanks for sharing your blog post! I’m very impressed how you found the bottleneck and rewrote the parsing part with Nokogiri with the pool of forked processes. Awesome job!

)

    exAspArk

    Written by

    exAspArk