gpt4 book ai didi

multithreading - Lua channel 和多核支持 : Can it be done?

转载 作者:行者123 更新时间:2023-12-02 05:54:03 28 4
gpt4 key购买 nike

Lua Lanes说它通过多线程支持多核。这不是不正确吗?您不需要使用多个进程来利用多个内核吗? Lua Lanes 会这样做吗?

也许我误解了他们在说什么。这是他们网站上的一段话:

Lua Lanes is a Lua extension library providing the possibility to run multiple Lua states in parallel. It is intended to be used for optimizing performance on multicore CPU's and to study ways to make Lua programs naturally parallel to begin with.

谢谢

最佳答案

这取决于操作系统,但大多数当前操作系统(Windows、Linux/*nix 等)通过线程而不是进程将任务分配到核心/CPU。因此,具有多个线程的单个进程可以在多个内核上运行。

Lanes 使用真正的 OS 线程,而不是轻量级的 Lua 线程 - 协程,因此调度器实际上可以将它分配到多个内核上。

关于multithreading - Lua channel 和多核支持 : Can it be done?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4825264/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com