DEV Community

Discussion on: Concurrency is not the parallelism

Collapse
 
drbearhands profile image
DrBearhands

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.

Collapse
 
blackbird profile image
Omkar Ajnadkar

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.

Collapse
 
drbearhands profile image
DrBearhands • Edited

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).