Concurrency is an idea in computer science in which multiple computations (called processes or threads) are being performed simultaneously. Scratch allows many scripts to run at the same time, though only one block may be busy at any one point. Each highlighted script runs in its own thread.

Benefits of Concurrency

Concurrency is beneficial for multiple reasons:

  • Concurrency can allow your project to continue running through intensive processes.
  • Concurrency allows you to have many things updating simultaneously.

Downfalls of Concurrency

While concurrency has many benefits and is used in many projects, concurrent modification, or two or more processes operating on the same data simultaneously can cause many issues, or race conditions. Race conditions are prevented by using synchronization. In Scratch one does not usually need to worry about race conditions, because only one block may be busy at any one point and control only moves from one script to another at certain points.

Concurrency in Other Programming Languages

Some other programming languages, such as Lua, have concurrency support, with coroutines. A 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

External Links