5 ms·
Modern concurrency tools for Ruby
- tomc1985 11y agoThis is cool! Both to use, and to study. Thank you!
- mattiemass 11y agoShame on me for thinking that you needed other languages for good concurrency. This looks awesome!
- xiaoma 11y agoThe GIL prevents parallelism but not concurrency.
- deleted 11y ago[deleted]
- keypusher 11y agoSo if I have 2 CPU-bound tasks, none of the tools in this toolbox will allow them to run in parallel on multiple cores?
- chrisseaton 11y agoNot if you use MRI, but they will if you use Rubinius or JRuby.
- vidarh 11y agoThey 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.
- s_kilk 11y agoCorrect, on MRI at least.
- est 11y agoIf you are even thinking about running CPU-intensive tasks in Python or Ruby, you are doing it wrong, it's not fast anyway.
- taf2 11y agoYep, in these cases use fork
- decentrality 11y agoUse 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.
- cschneid 11y agoI've used this library (the promises part) and it works fine. Error handling as a proc is mildly awkward, but worked out fine.
- rajangdavis 11y agoCan 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.
- chrisseaton 11y agoIt'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.
- decentrality 11y agoYou would probably like Celluloid better, if you're asking that question. See http://celluloid.io http://celluloid.io
- ashayh 11y agoThere is also the ruby parallel gem, https://github.com/grosser/parallel https://github.com/grosser/parallel
- taf2 11y agoThe 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?