ruby - 线程安全的 Ruby 解释器是什么意思?

标签 ruby thread-safety language-implementation

2000 interview 中(也就是 YARV 之前),Matz 说

Matz: I'd like to make it faster and more stable. I'm planning a full rewrite of the interpreter for Ruby 2.0, code-named "Rite". It will be smaller, easier to embed, thread-safe, and faster. It will use a bytecode engine. It will probably take me years to implement, since I'm pretty busy just maintaining the current version.

在这种情况下,“线程安全”是什么意思?允许您使用绿色线程的解释器?允许您使用 native 线程的解释器?没有全局解释器锁(YARV Ruby 术语中的 GVL)的解释器?

最佳答案

目前 ruby​​ 的线程不太理想。 Ruby 可以使用线程并且线程工作得很好,但由于其当前的线程机制,总而言之,一个解释器一次只能使用一个 CPU 内核;还有其他潜在问题。

如果你想要所有血淋淋的细节,This article涵盖得很好。

关于ruby - 线程安全的 Ruby 解释器是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10860823/

相关文章:

c# - 为什么我不能使 BackgroundWorker() 按预期工作?

functional-programming - 什么是FFP机器?

java - java中移位运算的实现

ruby-on-rails - 如何计算对象数量而不是获取 Ruby 中的所有对象?

ruby - : mean in rails before a variable name? 是什么

ruby - 我如何通知 Chef 执行需要参数的资源

compiler-construction - 编译语言中的垃圾收集实现

ruby-on-rails - 为什么 `duplicable?` 是这样定义的?

ruby - 创建一个线程安全的临时文件名

swift - 数组默认按值传递&线程安全