In this post I’m going to explain what is concurrency, parallelism and their differences.
First watch this video:
You can think of concurrency as two things that exist at the same time. For example when we use our computer we have different programs open, we might have chrome, and excel. So you can switch back and forth between them, because using one doesn’t mean we have to exit from other programs. That is concurrency, two or more things existing at the same time frame.
So if you think about it, concurrency is needed to do parallel processing, you need two processes to exist at the same time if you want to run them on parallel. (I exist, therefore I run? Bad joke I know..)
For instance when we leave music running in a chrome tab and then do something else in another, the tabs are concurrent with each other, they both exist simultaneously but we can only interact with one of them at any time since computers do not allow having multiple mouses running in parallel.(If you connect a second mouse to your PC, you don’t see a second mouse popping up in your screen)
If you switch super fast back and forth between concurrent processes you can give the user the illusion that the processes are running in parallel, which is what computer did before having multi-core processors.
You may be interested in: