Trusted answers to developer questions

What is concurrent programming?

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

Concurrency generally refers to events or circumstances that are happening or existing at the same time.

In programming terms, concurrent programming is a technique in which two or more processes start, run in an interleaved fashion through context switching and complete in an overlapping time period by managing access to shared resources e.g. on a single core of CPU.

This doesn’t necessarily mean that multiple processes will be running at the same instant – even if the results might make it seem like it.

svg viewer
svg viewer

Difference between Concurrent & Parallel programming

In parallel programming, parallel processing is achieved through hardware parallelism e.g. executing two processes on two separate CPU cores simultaneously.

A Real World Example

Concurrent: Two Queues & a Single Espresso machine.

svg viewer

Parallel: Two Queues & Two Espresso machines.

svg viewer

RELATED TAGS

concurrency
threads
parallel programming
parallelalgorithms
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?