Multithreading vs. Asynchronous

Multithreading & Asynchronous Programming are both Concurrent Programming.

Multithreading Asynchronous
CPU-concurrency I/O-concurrency
Thread class (old way) async.. await syntax
Task class (new way)

Task Parallel Library

Task Synchronous Programming Model

Task Parallel Library

Task Parallel Library is the preferred way of using Threads in C# for CPU concurrency.

image

var task = Task.Run((Action)DoProcess);
task.Wait();

Task Synchronous Programming Model

image

References

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s