Why doesn't Ruby have a ThreadPool built-in?

前端 未结 3 762
隐瞒了意图╮
隐瞒了意图╮ 2021-02-03 13:38

I have a program that creates 10000 threads at once, and runs 8 at the same time.

But ruby doesn\'t have a ThreadPool built-in as Java. Is there a good reason?

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-03 14:13

    Most likely the reason is because ruby doesn't have "real" threads. It has what are called Green threads. The ruby interpreter takes care of scheduling execution threads without using any underlying OS threads. This effectively makes Ruby single threaded.

提交回复
热议问题