Wikipedia-logo.svg For more information, see Concurrency (computer science) on Wikipedia.

Concurrency is an idea in computer science in which multiple computations (called processes or threads) are being performed at the same time. 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 projects to continue running through intensive processes.
  • Concurrency allows many things to update simultaneously.

Problems with 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 at the same time.

External Links

Cookies help us deliver our services. By using our services, you agree to our use of cookies.