For a couple of days, I am wondering what is the difference between this four types of programming.I search information in Google but I cannot answer my question so I decide to ask you, can someone explain to me please? Thank you !
Concurrency is having two tasks run in parallel on separate threads. However, asynchronous methods run in parallel but on the same 1 thread.
Parallel programming is a broad concept. It can describe many types of processes running on the same machine or on different machines. Multithreading specifically refers to the concurrent execution of more than one sequential set (thread) of instructions.
Asynchronous programming involves some calculations time-intensive tasks, which on the one hand are engaging a thread in the background but do not affect the normal flow of the program. Parallel programming incorporates several threads to perform a task faster and so does concurrent programming.
In a multithreaded process on a single processor, the processor can switch execution resources between threads, resulting in concurrent execution.
The programming keywords you have mentioned refer to techniques invented for specific reasons to solve problems in the field of computation and processing.
A concise essence of what each technique aims to solve:
Concurrency: There are many tasks at hand, I need a steadfast progress in each of them instead of completing one and moving on to the next in a serial approach. Let me work on each of the processes so that at a given point in time, there is non-zero progress in two or more tasks. (not necessarily in simultaneity)
Parallelism: There is potential for doing more work in unit time given my device resources. Let me use some techniques to increase throughput, possibly sacrificing latency, so that my task(s) finish quicker.
Multi-threading: Both my device hardware and software have support for more than one thread of execution in a program; Let me split the computationally intensive calculations across those processors/cores/thread-pools!
Asynchrony: A set of tasks to be completed. I am performing one of them currently. Let me call my friend to help me out with another task, I hope he/she comes back to me with the results while I continue performing my task.
Note that the techniques discussed above are not necessarily mutually exclusive. Specifically, multi-threading is a type of parallelism, which in turn does result in degree of concurrency being more than 1 (non-trivial multi-threading).
Incidentally, I've maintained a blog about parallel computing. In one of the posts, I've written about the jargon used in the same field.
https://magical-parallel-computing.blogspot.com/2017/04/parallel-computing-jargon.html
I hope it helps you at a conceptual level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With