What is synchoronous function?

Hello all! im making this post because i see a lot of people using a synchoronous function, i want to know why they are using synchoronous function and how it works

Synchronous events happen in order, one after another. Asychronous events happen with each other, unaffected by whatever else is happening. So, synchronous is single threaded, and asychronous is multithreaded.

But, looking this up would also give more details as I’m not sure of what exactly you mean.

As @bluebxrrybot said, it involves multi-threading with Parallel Lua.

I’m going to disclose that it’s not mandatory to use asynchronous code. This is an optimization that should be done once you understand how to code.

Let’s create a hypothetical situation where there are four cores on a cpu (virtually all cpus on devices nowadays are multicore). One of these cores is what Roblox runs on.

Synced code runs on the main thread (the same one Roblox runs on).

Asynchronous code runs on other threads (the three other cores in this situation). For example, if you have three snippets of code running asynchronously, they will each run on one of the cores in the cpu.

The reason this is an optimization is most people run all their code on a single core, which consequently limits the processing power to that core only. Performing calculations on another core with asynchronous code increases the maximum processing power (because it’s using all of the cores and not just one).

This is an overview of how it works, but there is more happening than what was specified.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.