Is Roblox single or multithreaded? I’m pretty sure it’s single.
What does it mean to “spawn” a new thread then?
Is Roblox single or multithreaded? I’m pretty sure it’s single.
What does it mean to “spawn” a new thread then?
If I’m not wrong, Roblox uses green threading, meaning that your code looks like it is using multiple threads but it’s actually just very intelligently swapping whenever you yield.
So yeah, Roblox is single-threaded.
By “spawning” a new thread, you can let code run on another thread without yielding the script which is creating the thread.
Roblox isn’t single nor is it multi-threaded, if you’re referring to Lua then yes it’s singlethreaded or as in Roblox “green threaded”.
The TaskScheduler runs at 60 Hz, that defines how fast you can resume threads from a paused state, it also handles multiple threads running in a queue.
Even when you spawn a new thread, it still runs on one hardware thread.
The Roblox engine is multi-threaded, Lua aside.
Lua itself was designed from the get-go to be single-threaded and mimick multi-threading.
However the roadmap suggests we will be able to run Lua on separate hardware threads by the end of the year. Traditionally people would just instance new Lua VMs in each thread and run divide code up that way, but that also proposes other challenges like figuring out how to make each thread talk to each other as they run in completely separate VMs.
It’ll be neat to see how Roblox solves this problem.
Roblox itself uses multiple threads but Roblox Lua runs currently only on a single thread.
Parallelization support for Roblox Lua is supposed to be released at the end of this year though.