Re: Parallel processes: multi-core, same CPU?
"'TopchetoEU' via lua-l" <[email protected]> Sun, 14 Jun 2026 14:22:27 +0000
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <UlCR9rE96qyRC8411nTNn4mBCNNoz40Bl7FVQ_zufzljsrtEZUqNLsW1oB2-BDkxBKTkSJcbo9MXuFV8SLqEe5I1XZiQ6rkOXOBJANVUbMY=@proton.me> |
This is a known limitation with lua - you can't run two lua threads (under the same lua_State) in parallel. AFAIK lua allows you to define some locking primitives, but they only serve to lock the current lua_State while lua code is executing, so in effect, only one lua thread is really executing at a time. Your best bet is to create one lua_State per OS thread and device some kind of communication protocol between different lua states (since two states cannot share tables). P.S.: Once upon a time I tried to rewrite the lua engine with parallelism in mind, but it was so hopefully slow I won't even dignify it with a link here. On Thursday, June 11th, 2026 at 3:21 AM, H J <[email protected]> wrote: > Leveraging fast shared memory access on the same (dual-core) CPU, I want to spawn two threads on each core of the same CPU. Is this possible with luajit? (I've been looking into `effil` but don't see how you can direct the task to a specific core...).-- Henk > > -- > You received this message because you are subscribed to the Google Groups "lua-l" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAJrhCY%2BwUejTLNbMf2WKauy2%3D%2B8%2BtVA-Jyoq14ABG96imjYH%2Bw%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/UlCR9rE96qyRC8411nTNn4mBCNNoz40Bl7FVQ_zufzljsrtEZUqNLsW1oB2-BDkxBKTkSJcbo9MXuFV8SLqEe5I1XZiQ6rkOXOBJANVUbMY%3D%40proton.me.