SlideShare una empresa de Scribd logo
1 de 21
a tour of




Asynchronous Programming
[Async CTP 3]
srikanth@brainscale.com/vishwanath.srikanth@gmail.com


Vishwanath.srikanth


Vishsrikanth


Vishwanathsrikanth.wordpress.com
                                   Vishwanath Srikanth
Topics for this Presentation


 Earlier ways    Awaiting Task            Task based
   of Async     asynchronously           Programming




                   We have features for every step of the way
EARLIER WAYS OF PROGRAMMING
ASYNC
Async Programming

Why do we need async?
• Responsive UI.
• Leverage Computing Power.
• Better Utilization of Resources.
• Better user experience.

 What is expected from Async programming patterns?
 • Transparent Remote operations
 • Easy to code
 • Cancellations, Timeouts, Preserving threads during blocking awaits etc.
Pre matured ways of async programming.

 Recommended Async Programming Concepts
 • Don’t wait for the response.
 • Return immediately after issuing a async request
 • Let the response call you back.

 Earlier ways
 • IAsyncResult Pattern Ex: BeginRead, EndRead
 • Event based Asynchronous pattern

                                                      Sync




                                                        Async
Pre matured ways of async programming.

 What went wrong?

 •   Disruptive Program Structure
 •   Error prone
 •   Heavy weight
 •   Difficult to design and write
New way of Async Programming DEMO
Awaiting a   AWAITING TASK ASYNCHRONOUSLY
  Task
What is Async CTP?

• A new language feature
• New framework pattern



What do you need to start working on
Async CTP

• Visual Studio 2011 Beta
• Visual Studio 2010 SP1 with Async
   CTP
Download from:
http://www.microsoft.com/download/e
n/details.aspx?id=9983
Task and Task<T>

 •   A Task is a representation of ongoing work
 •   Available in .NET 4
 •   Task returns nothing, Task<T> returns a result of type T.
 •   Normal tasks - Independent of Thread.

 • Async tasks run on same thread.




 • Propagate Exceptions
‘async’ modifier

 • Indicates Asynchrony
 • Can be used for methods or Events or Methods or Lambdas




 • Out and ref are not allowed.
 • Analogous to ‘yield’
‘await’ keyword

 • Await - Prepend to a method which can return Task, Task<T>
 • Everything that continues is compiled asynchronously
 • ‘Async’ Runs synchronously until first ‘await’.
Task based
Programming   TASK BASED ASYNC PATTERN
Task based async pattern

                            Async                                UI Thread
   Caller
                           Method
            Task/Task<T>

                             Create Task &
                                                  Check for callback

                            Wait for ‘await’
                                                  Load the Context

                            Capture Context           continue


                           Sign up a call back.
Task Based Asynchronous Pattern (TAP)

 • Task Behavior – Initialization, Exceptions, Target Environment, TaskStatus
 • Task States
     • Created, WaitingForActivation, WaitingToRun, Running,
        WaitingForChildrenToComplete, RanToCompletion, Canceled, Faulted.
 • Cancellation
 • Cancellations



 • Progress Reporting


 • Testable
 • TaskID
 • Task Creation Options – None, Prefairness, LongRunning, AttachedToParent
Consuming the Task Based Asynchronous Pattern

 • Continue Await using continuewith
 • Task.Yield()
 • Cancel Context - ConfigureAwait


 • Cancellation
     • Cancellation.None
 • Progress Reporting
Building Task-Based Combinators

Task.Run




Task.WhenAll



 - Aggregate Exception or All Exceptions
Building Task-Based Combinators
 Task.FromResult




 Task.WhenAny

  •   Redundancy
  •   Interleaving
  •   Throttling
  •   Early bailout
Questions



            Thank you!
There is more….

 Goodies……

 • Which namespace does Task belongs to ?
 • Can we utilize the power of multicore using
   Tasks?

Más contenido relacionado

La actualidad más candente

Elm - never get a runtime error anymore. Almost.
Elm - never get a runtime error anymore. Almost.Elm - never get a runtime error anymore. Almost.
Elm - never get a runtime error anymore. Almost.Anton Astashov
 
Serverless Application Model - Executing Lambdas Locally
Serverless Application Model - Executing Lambdas LocallyServerless Application Model - Executing Lambdas Locally
Serverless Application Model - Executing Lambdas LocallyAlex
 
NCUG 2019: Super charge your API’s with Reactive streams
NCUG 2019: Super charge your API’s with Reactive streamsNCUG 2019: Super charge your API’s with Reactive streams
NCUG 2019: Super charge your API’s with Reactive streamsFrank van der Linden
 
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...CocoaHeads Tricity
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in SalesforceDavid Helgerson
 
Performance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchPerformance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchYan Cui
 
Signal r azurepresentation
Signal r azurepresentationSignal r azurepresentation
Signal r azurepresentationJustin Wendlandt
 
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Dakiry
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingĐặng Thái Sơn
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAlex Thissen
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with KotlinTroy Miles
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive ApplicationMark Wilson
 
Spotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda ArchitectureSpotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda ArchitectureEsh Vckay
 

La actualidad más candente (20)

Elm - never get a runtime error anymore. Almost.
Elm - never get a runtime error anymore. Almost.Elm - never get a runtime error anymore. Almost.
Elm - never get a runtime error anymore. Almost.
 
Serverless Application Model - Executing Lambdas Locally
Serverless Application Model - Executing Lambdas LocallyServerless Application Model - Executing Lambdas Locally
Serverless Application Model - Executing Lambdas Locally
 
Reasonable app development
Reasonable app developmentReasonable app development
Reasonable app development
 
NCUG 2019: Super charge your API’s with Reactive streams
NCUG 2019: Super charge your API’s with Reactive streamsNCUG 2019: Super charge your API’s with Reactive streams
NCUG 2019: Super charge your API’s with Reactive streams
 
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
 
Dev-Friendly Ops
Dev-Friendly OpsDev-Friendly Ops
Dev-Friendly Ops
 
CSharp 5 Async
CSharp 5 AsyncCSharp 5 Async
CSharp 5 Async
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
 
Performance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchPerformance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatch
 
Signal r azurepresentation
Signal r azurepresentationSignal r azurepresentation
Signal r azurepresentation
 
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
 
Variables in Pharo5
Variables in Pharo5Variables in Pharo5
Variables in Pharo5
 
Introduction to Functional Reactive Programming
Introduction to Functional Reactive ProgrammingIntroduction to Functional Reactive Programming
Introduction to Functional Reactive Programming
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
Why I am hooked on the future of React
Why I am hooked on the future of ReactWhy I am hooked on the future of React
Why I am hooked on the future of React
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
 
Anatomy of a Reactive Application
Anatomy of a Reactive ApplicationAnatomy of a Reactive Application
Anatomy of a Reactive Application
 
Chatbots with Serverless
Chatbots with ServerlessChatbots with Serverless
Chatbots with Serverless
 
How to deploy your Apps in serverless-way using App Engine.pptx
How to deploy your Apps in serverless-way using App Engine.pptxHow to deploy your Apps in serverless-way using App Engine.pptx
How to deploy your Apps in serverless-way using App Engine.pptx
 
Spotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda ArchitectureSpotify's Music Recommendations Lambda Architecture
Spotify's Music Recommendations Lambda Architecture
 

Similar a Async CTP 3 Presentation for MUGH 2012

Task parallel library presentation
Task parallel library presentationTask parallel library presentation
Task parallel library presentationahmed sayed
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and awaitvfabro
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)Panagiotis Kanavos
 
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinC# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinXamarin
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)jeffz
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)Panagiotis Kanavos
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and pythonChetan Giridhar
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await ExplainedJeremy Likness
 
Asynchronous programming - .NET Way
Asynchronous programming - .NET WayAsynchronous programming - .NET Way
Asynchronous programming - .NET WayBishnu Rawal
 
Writing Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaWriting Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaYardena Meymann
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with PythonAbhay Bhargav
 
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
The server side story:  Parallel and Asynchronous programming in .NET - ITPro...The server side story:  Parallel and Asynchronous programming in .NET - ITPro...
The server side story: Parallel and Asynchronous programming in .NET - ITPro...Panagiotis Kanavos
 
Asynchronous Programming in .NET
Asynchronous Programming in .NETAsynchronous Programming in .NET
Asynchronous Programming in .NETPierre-Luc Maheu
 
C# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingC# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingPraveen Prajapati
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debuggerIulian Dragos
 
Rundown of Async/Await in Rust
Rundown of Async/Await in RustRundown of Async/Await in Rust
Rundown of Async/Await in RustKnoldus Inc.
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Ddd melbourne 2011 C# async ctp
Ddd melbourne 2011  C# async ctpDdd melbourne 2011  C# async ctp
Ddd melbourne 2011 C# async ctpPratik Khasnabis
 

Similar a Async CTP 3 Presentation for MUGH 2012 (20)

Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Task parallel library presentation
Task parallel library presentationTask parallel library presentation
Task parallel library presentation
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (English)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (English)
 
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinC# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
 
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)Parallel and Asynchronous Programming -  ITProDevConnections 2012 (Greek)
Parallel and Asynchronous Programming - ITProDevConnections 2012 (Greek)
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await Explained
 
Asynchronous programming - .NET Way
Asynchronous programming - .NET WayAsynchronous programming - .NET Way
Asynchronous programming - .NET Way
 
Writing Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & AkkaWriting Asynchronous Programs with Scala & Akka
Writing Asynchronous Programs with Scala & Akka
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
The server side story:  Parallel and Asynchronous programming in .NET - ITPro...The server side story:  Parallel and Asynchronous programming in .NET - ITPro...
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
 
Asynchronous Programming in .NET
Asynchronous Programming in .NETAsynchronous Programming in .NET
Asynchronous Programming in .NET
 
C# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingC# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programming
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
 
Async programming in c#
Async programming in c#Async programming in c#
Async programming in c#
 
Rundown of Async/Await in Rust
Rundown of Async/Await in RustRundown of Async/Await in Rust
Rundown of Async/Await in Rust
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Ddd melbourne 2011 C# async ctp
Ddd melbourne 2011  C# async ctpDdd melbourne 2011  C# async ctp
Ddd melbourne 2011 C# async ctp
 

Más de Sri Kanth

Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)
Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)
Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)Sri Kanth
 
Build Proactive bot using Microsoft Bot Framework
Build Proactive bot using Microsoft Bot FrameworkBuild Proactive bot using Microsoft Bot Framework
Build Proactive bot using Microsoft Bot FrameworkSri Kanth
 
Windows Server Containers
Windows Server ContainersWindows Server Containers
Windows Server ContainersSri Kanth
 
Windows server containers
Windows server containersWindows server containers
Windows server containersSri Kanth
 
Windows server containers
Windows server containersWindows server containers
Windows server containersSri Kanth
 
Big data and hadoop
Big data and hadoopBig data and hadoop
Big data and hadoopSri Kanth
 

Más de Sri Kanth (7)

Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)
Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)
Run UI Automation Tests using Selenium Grid and Azure Container Service (AKS)
 
Build Proactive bot using Microsoft Bot Framework
Build Proactive bot using Microsoft Bot FrameworkBuild Proactive bot using Microsoft Bot Framework
Build Proactive bot using Microsoft Bot Framework
 
Windows Server Containers
Windows Server ContainersWindows Server Containers
Windows Server Containers
 
Windows server containers
Windows server containersWindows server containers
Windows server containers
 
Windows server containers
Windows server containersWindows server containers
Windows server containers
 
Big data and hadoop
Big data and hadoopBig data and hadoop
Big data and hadoop
 
Introducing
IntroducingIntroducing
Introducing
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Async CTP 3 Presentation for MUGH 2012

  • 1. a tour of Asynchronous Programming [Async CTP 3]
  • 3. Topics for this Presentation Earlier ways Awaiting Task Task based of Async asynchronously Programming We have features for every step of the way
  • 4. EARLIER WAYS OF PROGRAMMING ASYNC
  • 5. Async Programming Why do we need async? • Responsive UI. • Leverage Computing Power. • Better Utilization of Resources. • Better user experience. What is expected from Async programming patterns? • Transparent Remote operations • Easy to code • Cancellations, Timeouts, Preserving threads during blocking awaits etc.
  • 6. Pre matured ways of async programming. Recommended Async Programming Concepts • Don’t wait for the response. • Return immediately after issuing a async request • Let the response call you back. Earlier ways • IAsyncResult Pattern Ex: BeginRead, EndRead • Event based Asynchronous pattern Sync Async
  • 7. Pre matured ways of async programming. What went wrong? • Disruptive Program Structure • Error prone • Heavy weight • Difficult to design and write
  • 8. New way of Async Programming DEMO
  • 9. Awaiting a AWAITING TASK ASYNCHRONOUSLY Task
  • 10. What is Async CTP? • A new language feature • New framework pattern What do you need to start working on Async CTP • Visual Studio 2011 Beta • Visual Studio 2010 SP1 with Async CTP Download from: http://www.microsoft.com/download/e n/details.aspx?id=9983
  • 11. Task and Task<T> • A Task is a representation of ongoing work • Available in .NET 4 • Task returns nothing, Task<T> returns a result of type T. • Normal tasks - Independent of Thread. • Async tasks run on same thread. • Propagate Exceptions
  • 12. ‘async’ modifier • Indicates Asynchrony • Can be used for methods or Events or Methods or Lambdas • Out and ref are not allowed. • Analogous to ‘yield’
  • 13. ‘await’ keyword • Await - Prepend to a method which can return Task, Task<T> • Everything that continues is compiled asynchronously • ‘Async’ Runs synchronously until first ‘await’.
  • 14. Task based Programming TASK BASED ASYNC PATTERN
  • 15. Task based async pattern Async UI Thread Caller Method Task/Task<T> Create Task & Check for callback Wait for ‘await’ Load the Context Capture Context continue Sign up a call back.
  • 16. Task Based Asynchronous Pattern (TAP) • Task Behavior – Initialization, Exceptions, Target Environment, TaskStatus • Task States • Created, WaitingForActivation, WaitingToRun, Running, WaitingForChildrenToComplete, RanToCompletion, Canceled, Faulted. • Cancellation • Cancellations • Progress Reporting • Testable • TaskID • Task Creation Options – None, Prefairness, LongRunning, AttachedToParent
  • 17. Consuming the Task Based Asynchronous Pattern • Continue Await using continuewith • Task.Yield() • Cancel Context - ConfigureAwait • Cancellation • Cancellation.None • Progress Reporting
  • 18. Building Task-Based Combinators Task.Run Task.WhenAll - Aggregate Exception or All Exceptions
  • 19. Building Task-Based Combinators Task.FromResult Task.WhenAny • Redundancy • Interleaving • Throttling • Early bailout
  • 20. Questions Thank you!
  • 21. There is more…. Goodies…… • Which namespace does Task belongs to ? • Can we utilize the power of multicore using Tasks?