From Test-Scratch-Wiki
![]() |
This page has links to outside of the Scratch website or Wikipedia. Remember to stay safe when using the internet as we can't guarantee the safety of other sites. |
Concurrency is an idea in computer science in which multiple computations are being processed simultaneously. In Scratch, concurrency means that you (apparently) can run multiple blocks simultaneously. The current Scratch player does this by switching the execution between different execution threads. Thus, multiple Scratch block are never executed at the same time. Thus, Scratch does not meet the true definition of concurrency but Scratch mimics concurrency in its execution.
Benefits of Concurrency
Concurrency is beneficial for multiple reasons:
- Concurrency can allow your project to continue running through intensive processes.
- Concurrency can help speed up your project. This can also be done through the use of a Single Frame.
- Concurrency allows you to have many things updating simultaneously.
Downfalls of Concurrency
While concurrency has many benefits and is used in many projects, it can also have many issues:
- Concurrent modification, or 2 processes attempting to modify something simultaneously can cause unexpected results.
- Concurrency can make controlling code flow quite difficult.
Concurrency in other programming languages
Some other programming languages, such as Lua, have concurrency support, with coroutine
s. A full list of languages that support concurrency can be found here.
Examples
Concurrency has many uses in Scratch:
- Performing complex mathematical functions.
- Rendering graphics
- Moving multiple sprites simultaneously