Member-only story
Understanding the Roots of Concurrency and Parallelism in Programming

A lot of times, I've heard that concurrency and parallelism are not the same thing. They’re different. And every programming language has some mechanism for implementing both. I never dived deeper into it until recently. In this article, we’ll look at the basics of concurrency and parallelism, and understand the concepts surrounding these. We will look at all think around concurrency in any programming language.
But before we understand these, let’s look at what a CPU does when we run our programs.
CPU and Clock Speed
The CPU is responsible for processing instructions embedded in a computer program. It is the heart that executes your program the way you write it. Every CPU comes with a clock specification. For instance, consider a single CPU with 1 core has a clock speed of 3.5 Ghz. This means that the CPU can execute approximately 3.5 billion Instructions per second. It may be less or more as well. Just for the purposes of this tutorial, let’s assume that a single CPU can execute billions of instructions every second.
However, even with this speed — there is one constraint on instruction execution.
A CPU with one core can execute only one instruction at a time.