concurrency

Having several pieces of work in progress during overlapping periods of time, such as requests being handled at once.

In more detail

Concurrent tasks need not run at the same instant: a single thread can switch between tasks whenever one is waiting for input or output, while truly simultaneous execution on several processor cores is called parallelism. Tasks that share data can interleave in unpredictable ways, so shared state needs protection such as locks, transactions or atomic operations. Bounding concurrency, for example with a fixed worker pool, stops a busy service from exhausting a dependency.

Examples

Go: one goroutine per health-check target
Java: threads, ExecutorService and CompletableFuture are the main tools.
Node.js achieves concurrency on its one main thread through the event loop.
A database lets many readers and writers work at once without corrupting data, which a shared file cannot.

Related terms

Taught in

References

Certification courses