Concurrency vs Multi-threading vs Asynchronous Programming : Explained

Recently, I was speaking in an event and I asked a question to the audience in between my talk about Asynchronous programming , I found that some of the people were confused between multi-threading and asynchronous programming and some were saying that both are same. So I thought of explaining these terms and add one more term Concurrency. Here there are two concepts involved and both are completely different, First – Synchronous and  Asynchronous programming and second – Single threaded and multi-threaded applications. Each programming model (Synchronous and Asynchronous ) can run in single threaded and multi-threaded environment. Let’s discuss these in detail.

Synchronous Programming model – In this programming model, when a thread assigned to one task and start executing. Then completes the executing task then able to take up another task. In this model, it can not leave the executing task in between to take up some another task. Lte’s discuss how this model works in single and multi-threaded scenario.

Single Threaded – If we have couple of tasks to be worked on and the current system provides a single thread which can work all those, then it takes one by one and process as

singlethreadedHere we can see that we have a thread (Thread 1 ) and four tasks to be completed. Thread starts processing one by one and completes all. (The order in which tasks will be taken up, does not affect the execution, we can have different algorithm which can define the priorities of tasks)

Multi-Threaded – In this scenario, we used to have multiple threads which can take up the tasks and start working on that. It mans we have pools of threads (new threads also created based on the requirement and available resources) and bunch of tasks. So these thread can work on it as

multithreadedHere we can see that we have four threads and same number of tasks to complete and each thread start working on that This is ideal scenario but in normal cases, we used to have more number of tasks then number of available threads so whichever thread gets free takes up another task. As already said that spawning new thread is not an option every time because it requires system resources like CPU, memory and based on that number of threads should be decided.

Now Let’s talk about Asynchronous model and how does it behave in single and multi-threaded environment.

Asynchronous Programming Model – In contrary to Synchronous programming model, here a thread once start executing a task it can hold it in between and save the current state and start executing another task.

async-singleHere we can see that a single thread is responsible to complete all the tasks and tasks are interleaved to each other.

If our system is capable of having multiple threads then all the threads can work in asynchronous model as well a below

Async-mutlithreadedHere we can see that same task say T4, T5, T6.. are handled by multiple thread. This is the beauty of this scenario. As you can see that T4 was started first Thread 1 and completed by Thread 2. Similarly T6 is completed by Thread 2, Thread 3 and Thread 4.It shows the maximum utilization of the threads.

So till now we have discussed four scenarios –

  1. Synchronous Single Threaded
  2. Synchronous Multi-Threaded
  3. Asynchronous Single Threaded
  4. Asynchronous Multi-Threaded

Let’s discuss one more term – Concurrency.


In simple terms, concurrency means processing multiple requests at a time. As we have discussed two scenarios where multiple requests were getting processed, Multi-threaded programming and asynchronous model ( single and multi-threaded both). In case of asynchronous model whether single or multi-threaded at a time multiple tasks are in progress, some are in hold state and some is getting executed.There are many flavors of it bt that is beyond the scope of this post.

As discussed earlier, the new age is of asynchronous programming. Why is it so important?

Benefits of Asynchronous Programming

There are two things are very important for any application – Usability and Performance. Usability because say an user clicked on button to save some data as it requires multiple tasks like reading and populating data in internal object, establishing connection with SQL and saving it there etc. As SQL runs on another machine in network and runs under different process, it could be time consuming may take bit long. So If the request is handled by single thread then the screen will be in hanged state till the process completes. That’s why now a days many application and new framework completely rely asynchronous model.

Performance of application and system is also very important. It has been seen that while executing a request, around 70-80% of the the gets wasted in while waiting the dependent tasks. So this can be maximum utilized by asynchronous programming where once once the task is passed to another process (say SQL) current thread save the state and available to take another process and when the sql task completes any thread which is free can take up the task.

Asynchrony in ASP.NET

Async in ASP.NET can be a major boost in the throughput of your application. Lets how IIS processes a request.

CLRWhen a request is received by IIS, it takes a thread from CLR thread pool (IIS does not own any thread-pool itself instead uses CLR thread pool) and assigns to it which further processes the request. As number of threads are limited and new ones can be created at a certain limit then if the thread wastes most of the time in waiting state then it is going to hit hard your server or you can assume it is reality. But if you write asynchronous code (which now become very easy and can be written almost similar to synchronous using the new keywords async/await) then it will way faster for you and throughput of your server will increase significantly because instead of waiting something to complete, it will be available to thread pool to take new request. If the application has a lots of dependency and long running process then for those application, async programming will be bot less than a boon

So now we have understood the difference in multi-threading, asynchronous programming and the kind f benefit we can get using asynchronous programming model.


12 thoughts on “Concurrency vs Multi-threading vs Asynchronous Programming : Explained

  1. I really liked this article. I was also confused in synchronous and asynchronous approach. Thank you for making it clear in a very easy way. I request if you can post some examples of await or asynchronous model.

  2. @Brij, Can you please clarify this to me. Lets assume I have

    Asynchronous Single Threaded(Thread1) Program with 2 tasks(task1- long running task & task2)
    Async – means Thread1 can take up task2 wihtout the task1 being completed.
    Await – means Thread1 has to wait for task1 to be completed before processing task2.–so what is the use of using aysnc if the Thread1 waits for the task1 to be completed ? It again becomes a syncrhonous propgramming right ? Correct me where I am wrong.


  3. Pingback: Asynchronous programming with async and await : explained | Code Wala

  4. Thanks for your nice article. I have been confused about Multi-threading vs Asynchronous for a time.

    I request if I can translate this article to Chinese as my first translation as I wanna my friends can also read it. I’ll keep the URL of your origin text.

    Thanks again

  5. Pingback: Kiến thức cần nắm – phuoclq

  6. hey Brij, thanks for explaining these concepts … I have sen many people who starts learning the multi-threading but don’t have this base knowledge. You have explained very well. Once again thanks fro sharing your knowledge. This article is very helpful.

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s