在Ruby中处理多个进程 [英] Working with multiple processes in Ruby

查看:58
本文介绍了在Ruby中处理多个进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在用于Ruby的模块,该模块可以轻松地在多个进程之间共享对象?我正在寻找类似于Python的多重处理,它支持进程安全队列和可以在进程之间共享的管道.

Is there a module for Ruby that makes it easy to share objects between multiple processes? I'm looking for something similar to Python's multiprocessing, which supports process-safe queues and pipes that can be shared between processes.

推荐答案

将提供简单的进程间通信的DRb与两个都是线程安全队列的Queue或SizedQueue结合起来,应该可以为您提供所需的信息.

Combining DRb, which provides simple inter-process communication, with Queue or SizedQueue, which are both threadsafe queues, should give you what you need.

您可能还想查看 beanstalkd (它也托管在

You may also want to check out beanstalkd which is also hosted on github

这篇关于在Ruby中处理多个进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆