Lua :: How to write simple program that will load multiple CPUs?

后端 未结 6 563
猫巷女王i
猫巷女王i 2021-02-07 17:27

I haven\'t been able to write a program in Lua that will load more than one CPU. Since Lua supports the concept via coroutines, I believe it\'s achievable.

Reason for me

6条回答
  •  一生所求
    2021-02-07 18:08

    It's very easy just create multiple Lua interpreters and run lua programs inside all of them.

    Lua multithreading is a shared nothing model. If you need to exchange data you must serialize the data into strings and pass them from one interpreter to the other with either a c extension or sockets or any kind of IPC.

提交回复
热议问题