A visual comparison of concurrency and parallelism.

In computer science the words concurrency and parallelism are often used synonymously. This is wrong. These are two very different ideas and we're here to set you straight.

Keep scrolling. Using some typical examples, we'll show you the difference between concurrency and parallelism.

down icon
house person

A short introduction.

This is you. Say hi! You're about to move, so you need to move your boxes from your house to the moving van. Some boxes are heavy, these boxes take you longer to carry. Other boxes are super light, so you're able to carry them no problem! This is the example we're going to explore to explain concurrency and parallelism. We'll also compare both of them to typical sequential programming.

Before we delve into the nitty gritty of parallelism and concurrency, let's first take a quick peek at a little background information.

A little background.

From roughly 1980-2005, desktop computers got exponentially faster at running sequential programs. But no one knows how to continue this advancement due to various technological limitations. So, we started putting multiple processors on the same chip. This is the magic sauce that allowed us to begin parallel programming. We're able to get two things done at the same time. Is your mind blown yet? Probably not. But we'll get there!

Looking at this visualization you can see that in 2005 processors seem to get slower. Why would that be? Experts guess that because companies started putting multiple processors on the same chip that speed no longer became as important. Two processors that are each 2mhz each can still process data faster than one 3mhz processor.

Sequential programming.

Before we get into the good stuff, let's look at the basics. Sequential programming is similar to a person who doesn't have anyone there to help them move. They can only take one box at a time. They take one box, place it in the truck, then take the next and so on until all the boxes are in the truck. This sad, friendless person takes much longer to accomplish their task because they can only complete one task at once.

This is how many traditional programs are run. Sequential programming starts at the top of the script, executes the first function, then continues onto the next. Nothing fancy here, but definitely necessary for most of the modern programs we have today.

Concurrency explained.

Concurrency shakes up sequential programming a little bit. It mostly helps with resource allocation. Placed within our example, you and a few friends are moving your boxes. Not all the boxes have been fully packed yet, so you go grab the first fully packed box and start moving it. While your doing this one of your friends is packing up another box. They don't start lifting and moving their box, because you only have one small moving truck and only one of you can comfortably place boxes into the truck at a time. Once you're done placing your box in the truck, your friend can then start moving their box without running into you. They also have free access to the truck. Then another friend can go and grab their box and start packing it up to move.

This type of programming is helpful because it correctly and efficiently manages access to shared resources. It allows two or more tasks to start, run, and complete in overlapping time periods. This doesn't mean they'll ever be running at the same instant. This way you and your friends can finish packing a little bit faster, even if it still takes awhile.

Parallelism explained.

Parallelism is where the real magic happens. You and your friends decide that it would be faster to have two trucks. This way two different people can go grab boxes and place them into the truck without getting in the way of someone else trying to place their box in the truck. So you get two trucks and split up the boxes so you know which ones go into which truck. From here two people are able to grab boxes and begin moving them at the same time.

With parallelism you are using extra resources to solve a problem faster. With a multicore processor tasks are able to run at the same time. This is how your computer can run multiple programs at the same time. It also helps get things done faster. This is the real magic of the programming world.

A side-by-side

comparison.

Sequential
Concurrent
Parallel

Our team.

Cameron.

Animator to the extreme, led the development efforts.

Katrina.

Designer, developer, overall cool chick.

Kanon.

Chart creator of your dreams, she gets down with d3.

Sanchya.

Hard to pronounce name, easy to understand graphs.