SlideShare a Scribd company logo
1 of 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?

More Related Content

What's hot

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
 

What's hot (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 to 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 to 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
 

More from 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
 

More from 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
 

Recently uploaded

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Recently uploaded (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

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?