Re:Demystifying Ruby (1/3): It's all about threads
by jemmyw on Thursday May 15, 2025 @06:30PM
(#44000032)
Ruby hasn't stopped either and the last few years have seen a lot of improvement in it's concurrency story. I still prefer it to Elixir, that's just personal preference rather than a weigh up.
Re:Demystifying Ruby (1/3): It's all about threads
by jemmyw on Thursday May 15, 2025 @06:26PM
(#44000000)
> This makes Ruby threads lightweight (also known as “Green Threads”)
It's a shame they got this wrong and didn't discuss threads much. Ruby threads, since 1.9, are really threads managed by the OS and are not green threads. The parallelism is limited by the goal interpreter lock, but calling out to non Ruby code may be parallel, otherwise all those libraries the author mentions wouldn't bother. That "may" is an annoying point of order though.
It's a shame they got this wrong and didn't discuss threads much. Ruby threads, since 1.9, are really threads managed by the OS and are not green threads. The parallelism is limited by the goal interpreter lock, but calling out to non Ruby code may be parallel, otherwise all those libraries the author mentions wouldn't bother. That "may" is an annoying point of order though.
Really this is just a discussion of concurrency on the MRI rather than something to the Ruby language itself.