Hacker News new | past | comments | ask | show | jobs | submit login
Modern concurrency tools for Ruby (github.com/ruby-concurrency)
131 points by sciurus on March 9, 2016 | hide | past | favorite | 16 comments



Shame on me for thinking that you needed other languages for good concurrency. This looks awesome!


Use Rubinius or jRuby and not MRI if you want to escape the GIL. If you use any concurrency approaches with a GIL in place, there will be only an appearance of parallelism.


The GIL prevents parallelism but not concurrency.


So if I have 2 CPU-bound tasks, none of the tools in this toolbox will allow them to run in parallel on multiple cores?


They can't run in parallel while in the interpreter on MRI. Code that spends lot of time in the kernel (long running system calls for IO etc.) or in C extensions (say database adapters) can run properly in parallel, so on MRI it very much depends on your workload.

If you want to ensure proper parallelism, then fork.


Not if you use MRI, but they will if you use Rubinius or JRuby.


If you are even thinking about running CPU-intensive tasks in Python or Ruby, you are doing it wrong, it's not fast anyway.


Correct, on MRI at least.


Yep, in these cases use fork


The thread safe Array class is interesting how is that different from ruby's built in Queue class- in what context I guess would it make sense in place of Queue?


I've used this library (the promises part) and it works fine. Error handling as a proc is mildly awkward, but worked out fine.


Can someone please help me out and explain how to use this library? Or explain the use cases for which a library like this would be a good fit.


It's a toolbox library so to explain how to use it in general I'd have to explain all of those tools individually.

If you're familiar with concurrency or parallelism in another language I can tell you how to achieve something similar in many cases using concurrent-ruby.

Or if you have some algorithm you want to make concurrent or parallel from scratch ask us in the Gitter room.


You would probably like Celluloid better, if you're asking that question.

See http://celluloid.io


There is also the ruby parallel gem, https://github.com/grosser/parallel


This is cool! Both to use, and to study. Thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: