Concurrency is not the parallelism

Omkar Ajnadkar on November 24, 2018

This post is inspired by two things: How to make Python code concurrent with 3 lines rhymes ... [Read Full]
markdown guide
 

So I'm going to be rather negative here, because I think I should be.

The first line on wikipedia:

In computer science, concurrency refers to the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome.

vs. your post:

Concurrency: Fooling you and running processes alternatively

There is quite a difference.

And parallelism does not require multiple cores. That's just one way of doing things.

Although we have all made mistakes and said something inaccurate at some point in time, for posts, which take time to make anyway, you should really make a minimal effort to check your assumptions. Otherwise, you spread misinformation and confusion among your readers, essentially making them slightly worse devs after reading this.


  • Concurrent: not (completely) ordered; at least some parts can run simultaneously.

  • Parallel: parts do run simultaneously.

  • Interleaved: 'mixed' but not run at the same time (situation 2 from the post).

So concurrent code can be executed in parallel, interleaved or entirely sequentially.

In software development you don't generally have full control over how your program will run exactly; you can give hints but your OS will make decisions based on e.g. the current load.
That means that generally we talk about concurrent software and parallel hardware, but that is not part of the distinction.

There is quite a variety in how things can be parallel (multi-cores, hardware threads, GPU, VLIW, FPGA...), you can even sort-of run sequential code in parallel (pipelines), which we do all the damn time.

 

Hey,
Thanks for your suggestions. Although I am no expert in this topic, what I am trying to explain here is the difference between parallelism and concurrency. This is for those who think that parallelism is equivalent to concurrency, which is not and that's what I am trying to explain here.
In the line,

Concurrency: Fooling you and running processes alternatively

I am just trying to explain that concurrency does not mean processor is running more than one process simultaneously but user is thinking that more than one process is running.

 

I'm sorry, but your intention is irrelevant in this. Whatever it is you intended to do, what you have achieved is misinforming people.

You should edit your post to correct this for future readers (or delete it if you do not feel up to editing it).

 
 

I was sure that is a Go post, it is a common phrase in Gos community.

 
 

I guess if you talk about this threads should also be spoken about, as well as multiple cores dealing with the same process eg. games

code of conduct - report abuse