I have 2 questions
Does it use cores or threads?
Does it use the second core/thread or just an random one?
I have 2 questions
Does it use cores or threads?
Does it use the second core/thread or just an random one?
The idea behind task.syncronize
and its counterpart task.desyncronize
is to run multiple code blocks at the same time. While coroutines/threads simulate this behavior, Parallel Luau comes closer to truly implementing it through usage of multiple CPU cores. These methods themselves don’t really distribute the code to cores so much as their usage within scripts controlled by Actors
does, although that distribution is, from my understanding, determined by availability and hardware via ROBLOX’s underlying engine.
The actual implementation engine-side shouldn’t really impact you, and the Parallel Luau Developer Preview thread recommends writing code with the assumption of more cores being available rather than fewer. If a device running the code has fewer cores installed than there are Actors
running code, I would think they just get stacked as different threads distributed across available cores, but don’t quote me on that.
What should concern your design, though, is how ModuleScripts
are handled. In single-core design, ModuleScripts
can be used to create static or global data locations even if being require()
ed by multiple threads, which is convenient, but this does not work in multi-core designs. Each core has to run its own copy of a ModuleScript
, and these copies cannot communicate with one another–at least, not in Parallel Luau’s current implementation–so code needs to be written with this limitation in mind.