Concurrent vs. parallel programming

What is concurrent programming?

Concurrent programming refers to an application that makes on more than one task at the same time (concurrently). If a computer only has one CPU, then the application may not make progress on or execute more than one task at the same time, but more than one task can be processed at the same time within the application. It does not finish one task before it begins the next.

Concurrency means executing various tasks at the same time, but not necessarily together.

For example, suppose you went to purchase a coke. You see that there are two lines in front of the vending machine. So, only one person from a line at a time can get the coke, but both lines are making progress towards getting the coke. Take a look at the image below to understand it better, and then see the corresponding visual of a computer process.

Concurrent: 2 Queues and 1 Vending machine
1 of 2

What is parallel programming?

Parallel programming is when a computer makes progress on more than one task simultaneously. This usually happens when there is more than one CPU or CPU core present.

Parallel programming is to execute multiple tasks at the same time simultaneously.

Let’s take the same example, but now suppose you went to purchase a coke and there were two vending machines, each with its own line. So, now two people at a time can get a coke as there are two separate vending machines. Take a look at the image below for better understanding, and then see the corresponding visual of a computer process.

Parallelism: 2 Queues and 2 Vending machines
1 of 2

Free Resources