Prasanth
Prasanth

Reputation: 3041

What mechanism do async tasks use in ASP.Net MVC 4.0?

What is the mechanism behind async tasks in MVC 4? How is it related to normal threading? Please provide detail.

Upvotes: 3

Views: 723

Answers (4)

Stephen Cleary
Stephen Cleary

Reputation: 457027

Normally, a single ASP.NET page request is handled by a single thread. After the thread sends the response, it returns to the ASP.NET thread pool.

When you use async/await (or asynchronous pages), the thread handling the request marks the request as incomplete and then returns to the ASP.NET thread pool. When the awaitable completes later, an ASP.NET thread is assigned to run the rest of the method.

More specifically, async/await by default use SynchronizationContext. See my MSDN article for more details.

Upvotes: 1

Branko Dimitrijevic
Branko Dimitrijevic

Reputation: 52137

If you are interested in async and await keywords, you might find this Channel 9 interview with Anders Hejlsberg interesting.

Also, take a look at: this PDC video.

Upvotes: 2

tugberk
tugberk

Reputation: 58494

As already indicated before, async keyword is part of .Net. For better implementation of asynchronous programming, Microsoft has released several CTPs for this and it will be out of the box on .Net 4.5 AFAIK.

Below article is helpful as well :

http://www.juliencorioland.net/Archives/en-aspnet-mvc-4-asynchronous-controllers

Upvotes: 1

John Saunders
John Saunders

Reputation: 161821

Async Tasks is a feature of .NET, not of ASP.NET MVC 4. They work the same in ASP.NET as they do elsewhere within .NET.

Upvotes: 0

Related Questions