What is the difference synchronous and asynchronous programming?

preview_player
Показать описание
1. Full .NET Interview Course (with PDF Book)

C# / ASP.NET Core / MVC / API - Top 500 Interview Questions

Don't worry if course not helping you, Udemy has 30 days Free Refund Policy.

2. Quick Revision Book (PDF format)

Top 500 .NET Interview Questions - OOPS/ C#/ ASP.Net/ MVC/ SQL /.Net Core /Web API

50% Discount Applied on above link.

My best wishes are with you.
Рекомендации по теме
Комментарии
Автор

Async programs runs concurrently using only one main thread but if you use await it will create one more thread internally by TPL which is called callback thread to resume from that place.

Summary: asynchronous programming doesn't use multi threads.

Multi threading programs executes in parallel and async programs runs concurrently.

shobhamahadev
Автор

Threads don’t run parallel unless they run in different CPUs, otherwise they run concurrently.

roku_on_it
Автор

what is the difference between async and multi thread?

youraccountissuspended
Автор

What if i need the result of the first method as input for the second method?

davidemmanuel
Автор

That’s more multithreading programming rather than asynchronous. Asynchronous programming is meant to use as less threads as possible without blocking the calling method. Task.Run() schedules and runs task in another thread from thread pool

gltdhhl
Автор

How do you handle if it throws Thread Being Abort, If we have more threads get created?

anoopkumarg
Автор

This is not ayschronous problem ..its just your running thing in different thread

koustavmandal
Автор

What you explain is multi threading .
Its is asynchronous programming when all tasks wait and main thread doesn't exist till task finishes .

In your example console may only print 10 and main thread might exit .

koustavmandal
Автор

Since Method2() and Method3() would be ran at the same time, would that cause a race condition? Is there a situation where 30 could appear before 20 or will Method3() always run slightly after Method2()?

homebrew
Автор

How 10 is at last even though it's thread started to execute first?

shirishshinde
Автор

This is not asynchronous. There is no async or await keywords. You are misinforming people.

ivanvincent