What is the differene between concurrency and multithreading? Is concurrency only possible in multicore cpu? can anybody explain it with an example?
-
Possible duplicate of [Concurrency and Multithreading](http://stackoverflow.com/questions/1996648/concurrency-and-multithreading) – Mr Rho Jan 30 '16 at 09:32
-
Or [Concurrency vs Parallelism](http://stackoverflow.com/questions/1050222/concurrency-vs-parallelism-what-is-the-difference). – Linus Jan 30 '16 at 09:34
-
No sir..there the question actually asked is " why would specific languages be better at concurrency than others and why would fork()ing processes be a better solution rather than just using threads?" and that is not my question. My question is the difference between multithreading & concurrency. – Sneha S Jan 30 '16 at 09:39
-
is parallelism a synonym for concurrency or multithreading? – Sneha S Jan 30 '16 at 09:44
-
this might help http://codelexems.com/2014/11/03/clearing-up-the-terminology/ – Sleiman Jneidi Jan 30 '16 at 09:47
-
1Hover the [multithreading] and [concurrency] tags you placed on the question until a black popbox shows up and then click therein "info". – BalusC Jan 30 '16 at 10:08
-
@BalusC thts cool..i am new here..thx for the info. – Sneha S Jan 30 '16 at 10:17
-
1Multithreading is not a synonym for parallelism... however it's not an uncommon mistake to assume multithreading makes uses of multiple cores, which is a statement more accurate about parallelism. – Linus Jan 30 '16 at 18:24
2 Answers
What is the differene between concurrency and multithreading?
Concurrency describes the way in which processes run. They are either sequential (one after another), concurrent (able to make progress "at the same time" although not necessarily at the same instant), or parallel (they happen simultaneously).
Multi-threading is a technique which allocates individual threads of execution; they are essentially lightweight processes with some advantages with respect to shared resources from their parent.
If you pay close attention, multi-threading is possible on both concurrent and non-concurrent systems. A thread is a lightweight process (with respect to processes); so, having multiples of threads on a non-concurrent system would not result in parallel programming. They would still start and run until finished before the other. And on a concurrent system they would each get their fair share at some CPU time; they would all be making progress concurrently.
Is concurrency only possible in multicore cpu?
I think we know now, the answer to this is no. Concurrent execution of processes is taken for granted to the point it's widely misunderstood as parallelism; a much more powerful tool.
To give an example that provides some insight, think about your machine. It does all kinds of stuff all the time and you do not (hopefully) experience any lag in its performance. All these processes are running concurrently giving you, the user, a perception of parallelism even when on a single core machine (I know cause I'm old :)).
But what about a merge sort? Couldn't we perform two merge sorts simultaneously on two halves of the data; yes. But only if we have multiple cores/CPUs.

- 13,548
- 8
- 49
- 75
-
-
@SnehaS, on a single core system each process will "get it's turn" based on the scheduling algo of the system. s – ChiefTwoPencils Jan 30 '16 at 09:53
-
@SnehaS, you're welcome. I basically re-wrote the answer in hopes it will better serve you. Please consider adding an up vote or accept if it meets your needs. – ChiefTwoPencils Jan 30 '16 at 10:39
-
@ ChiefTwoPencils sure sir.. that edited ans is very much simple & informative..thank you. – Sneha S Jan 30 '16 at 10:46
Concurrency means doing multiple tasks simultaneously. It means multiple tasks are running parallely. So definitely to run multiple tasks parallely you need multiple threads.
So Concurrency is achieved by Multithreading
Now coming to your Question :
Is concurrency only possible in multicore cpu?
The answer is No.
If I have 2 threads and only 1 core. In this case, CPU will give time to each thread to complete its task. So Multithreading is even possible in single core CPU.

- 7,158
- 3
- 37
- 61
-
This is incorrect. Concurrency only says there are multiple processes *making progress*. That simply means that it is not the case that a single process starts and runs until finished until another get's a time quantum. Concurrency has been around since before multi-core/processor machines. – ChiefTwoPencils Jan 30 '16 at 09:56
-
I wrote Concurrency is achieved by Multithreading. Is it wrong ? – thedarkpassenger Jan 30 '16 at 09:57
-
1
-
@SnehaS: yeah it is. Without concurrency if you start two tasks, then either Task1 will run, then finish and then Task2 will complete. or Task2 will run first, then finish and Task1 will complete. But in the case of concurreny both tasks are making simultaneous progress – thedarkpassenger Jan 30 '16 at 10:00
-
@ChiefTwoPencils so, concurrency = multiple process making progress. it can be achieved by multithreading or parallelism( only in multicore). Am i right? – Sneha S Jan 30 '16 at 10:02
-
@ChiefTwoPencils: concurrency!=parallel ? https://en.wikipedia.org/wiki/Concurrency_%28computer_science%29 – thedarkpassenger Jan 30 '16 at 10:02
-
-
-
@ChiefTwoPencils: Can you give some reference which can clear my doubts about this topic ? – thedarkpassenger Jan 30 '16 at 10:05
-
-
Sure, at the top of the wiki you linked it says "for a more practical discussion" and gives this [link](https://en.wikipedia.org/wiki/Concurrent_computing) which clearly states that a distinction exists between concurrency and parallelism. – ChiefTwoPencils Jan 30 '16 at 10:08
-
-
-
@AnshulJain [link](http://baptiste-wicht.com/posts/2010/05/java-concurrency-part-1-threads.html) is also a gud one, i think.. – Sneha S Jan 30 '16 at 10:26