Thursday, January 3, 2013

Parallelism, Concurrency & Asynchrony


Concurrency is multi-tasking, sharing the CPU cycles. This is CPU bound, which means if there is more than a single task which are running concurrently a time slicing happens with the CPU time cycles to execute each of those tasks. Concurrency is achieved by creating threads which are assigned to thread pool.
Parallelism is the way if utilizing the multi core feature. If the core processors are more than one (dual core, or quard core, etc..), then the tasks can be assigned to different core processors. Here time slicing is not in picture, since each processor works on its respective task assigned.

Asynchrony is subset of Concurrency, which means Concurrency is a type of Asynchrony. As said Concurrency is achieved, creating threads for each task whereas Asynchrony will not lead to creation of new threads. Asynchrony works on the same thread, but will not block the thread for the asynchronous operations. To achieve this with in the same thread, callbacks are performed to the main thread when the asynchronous operation is completed.
Asynchrony concept is brought in .NET 4.5 CTP, using Async – Await (Asynchrony Pattern).

No comments: