DEV Community

Discussion on: Concurrency vs. Parallel vs. Async in .NET

Collapse
 
chinhp profile image
ChrisP • Edited

Let me summary them in a story

  • Bob started a restaurant and he does all the thing: Being a chef, being a waiter and cashier. this kind of system is non concurrency
  • More and more customers come. Bob decided to hire 1 Chef, 1 Waiter and 1 Cashier. He just enjoys to do the management things. Now, at the same time, Waiter gets order while Cashier collects payment from another customer: Now we have a *concurrency * system
  • The number of customer continues being increase. 1 waiter is not enough. Bob decided to get another waiter. Waiter 1 gets order from customer table number 1 to 10, waiter 2 gets order from table number 11 to 20. Getting order is now divided between 2 waiter. Now we have *Parallel * system.
  • Waiter 1 after getting the order, he bring the order to the kitchen and wait for the food. He just standing there and keep waiting for the Chef. After the food is ready, he bring the food to his customer and getting next order. Bob doesn't want to do this way, he ask waiter 1 stop waiting, After the food is ready, the chef will inform and either waiter 1 or waiter 2 can bring it to the customer. Now we have *Async *