All about asynchronous programming from .NET starting from initial framework to latest version. We will be looking into almost all features from .NET which are related to Asynchronous Programming. This seminar will cover up evolution of asynchronous programming and slowly moving to Task.
All about asynchronous programming from .NET starting from initial framework to latest version. We will be looking into almost all features from .NET which are related to Asynchronous Programming. This seminar will cover up evolution of asynchronous programming and slowly moving to Task.
Java 8 parallel streams are great. You just call stream.parallel() and suddenly your code is running much faster. Or is it? Do you know which thread pool is used? Do you know what happens if all the threads in the pool are busy or blocked? Do you know how to make sure that parallel processing just does not get stuck?
In this talk we will talk shortly about fork-join framework and how it is used in parallel streams. Then we will walk through several innocently looking examples and discuss why you really should think twice before using parallel streams.
Apache Beam: Lote portátil y procesamiento de transmisiónGlobant
Speaker: Albert Ramírez Cerquera
Video: https://youtu.be/18Tbr1LZmtM
En esta charla, vemos cómo utilizar el modelo de programación Apache Beam para procesar datos por batch y en streaming. Además, se enseñará cómo se puede ejecutar Beam en ejecutores como Flink y Google Cloud Dataflow.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Hay trabajos y hay carreras. Las oportunidades vienen a golpear la puerta cuando menos lo esperas. La decisión es tuya. Desde tener la oportunidad de hacer algo significativo día tras día, hasta estar rodeado de gente supremamente inteligente y motivada.
¿Estás listo?
Descúbre todas nuestras oportunidades acá: https://bit.ly/2PWKky9
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Síguenos en:
Facebook: https://www.facebook.com/Globant/
Twitter: https://twitter.com/Globant
Instagram: https://www.instagram.com/globantpics/
Linkedin: https://www.linkedin.com/company/globant
Visita nuestra página web: https://bit.ly/2XLVYQD
Presentation given at SoCal .NET Architecture group in March 2015. We introduced the async/await keywords and discussed architectural considerations: like why async may be superior to Parallel.ForEach and other parallel options, especially for server-side scaling
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Igalia
By Andy Wingo.
Three talks in one:
- The power of limits: Partial continuations in Scheme
- Postcards from the web: Lessons from JavaScript
- Guile in 2012: A look back at 2.0, a look forward to 2.2
The power of limits: Partial continuations in Scheme
I’ll describe what delimited continuations are, how they are better than call/cc, and then go on to demonstrate and describe an event-based cooperative threading system built with delimited continuations, showing how it makes for much clearer code. I’ll show a simple implementation of the memcached protocol.
Postcards from the web: Lessons from JavaScript
In this talk I will mention some things that I have learned about language implementations from having worked on V8 and JavaScriptCore.
Guile in 2012: A look back at 2.0, a look forward to 2.2
It will briefly summarize the 2.0 release series of Guile, how it went, what worked well and what didn’t. Then we’ll look forward to the next cycle, which is probably some 6 months away.
Apresentado na React Conf Brasil, em São Paulo, 7 de Outubro de 2017 #reactconfbr
Entusiasta da open web e software livre. Software Developer na globo.com e membro da JS foundation. Já trabalhou como desenvolvedor em empresas como Videolog e Petrobras. Em 2015, foi um dos desenvolvedores de software mais notáveis no GitHub, tendo feito contribuições significativas para projetos de código aberto por 500 dias seguidos. Orador em mais de vinte conferências dando palestras sobre tecnologias web como JavaScript / ES6, Web Performance, React e Canvas / WebGL.
http://raphamorim.io
@raphamundi
- Patrocínio: Pipefy, Globo.com, Meteor, Apollo, Taller, Fullcircle, Quanto, Udacity, Cubos, Segware, Entria
- Apoio: Concrete, Rung, LuizaLabs, Movile, Rivendel, GreenMile, STQ, Hi Platform
- Promoção: InfoQ, DevNaEstrada, CodamosClub, JS Ladies, NodeBR, Training Center, BrazilJS, Tableless, GeekHunter
- Afterparty: An English Thing
Functional Programming for OO Programmers (part 1)Calvin Cheng
The Why and Benefits of Functional Programming paradigm. Part 2 with source code can be found here: http://www.slideshare.net/calvinchengx/functional-programming-for-oo-programmers-part-2
Related source code https://github.com/calvinchengx/learnhaskell
Since the introduction of C#, async/await concepts are still misunderstood by many developers.
Async programming tries to solve three problems (Offloading, Concurrency, Scalability) in a mean abstraction.
This presentation is a good starting point to asynchronous programming in .net. There are many links and references, so do not hesitate to go deeper.
Java 8 parallel streams are great. You just call stream.parallel() and suddenly your code is running much faster. Or is it? Do you know which thread pool is used? Do you know what happens if all the threads in the pool are busy or blocked? Do you know how to make sure that parallel processing just does not get stuck?
In this talk we will talk shortly about fork-join framework and how it is used in parallel streams. Then we will walk through several innocently looking examples and discuss why you really should think twice before using parallel streams.
Apache Beam: Lote portátil y procesamiento de transmisiónGlobant
Speaker: Albert Ramírez Cerquera
Video: https://youtu.be/18Tbr1LZmtM
En esta charla, vemos cómo utilizar el modelo de programación Apache Beam para procesar datos por batch y en streaming. Además, se enseñará cómo se puede ejecutar Beam en ejecutores como Flink y Google Cloud Dataflow.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Hay trabajos y hay carreras. Las oportunidades vienen a golpear la puerta cuando menos lo esperas. La decisión es tuya. Desde tener la oportunidad de hacer algo significativo día tras día, hasta estar rodeado de gente supremamente inteligente y motivada.
¿Estás listo?
Descúbre todas nuestras oportunidades acá: https://bit.ly/2PWKky9
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Síguenos en:
Facebook: https://www.facebook.com/Globant/
Twitter: https://twitter.com/Globant
Instagram: https://www.instagram.com/globantpics/
Linkedin: https://www.linkedin.com/company/globant
Visita nuestra página web: https://bit.ly/2XLVYQD
Presentation given at SoCal .NET Architecture group in March 2015. We introduced the async/await keywords and discussed architectural considerations: like why async may be superior to Parallel.ForEach and other parallel options, especially for server-side scaling
Partial Continuations, Lessons From JavaScript and Guile in 2012 (Quasiconf 2...Igalia
By Andy Wingo.
Three talks in one:
- The power of limits: Partial continuations in Scheme
- Postcards from the web: Lessons from JavaScript
- Guile in 2012: A look back at 2.0, a look forward to 2.2
The power of limits: Partial continuations in Scheme
I’ll describe what delimited continuations are, how they are better than call/cc, and then go on to demonstrate and describe an event-based cooperative threading system built with delimited continuations, showing how it makes for much clearer code. I’ll show a simple implementation of the memcached protocol.
Postcards from the web: Lessons from JavaScript
In this talk I will mention some things that I have learned about language implementations from having worked on V8 and JavaScriptCore.
Guile in 2012: A look back at 2.0, a look forward to 2.2
It will briefly summarize the 2.0 release series of Guile, how it went, what worked well and what didn’t. Then we’ll look forward to the next cycle, which is probably some 6 months away.
Apresentado na React Conf Brasil, em São Paulo, 7 de Outubro de 2017 #reactconfbr
Entusiasta da open web e software livre. Software Developer na globo.com e membro da JS foundation. Já trabalhou como desenvolvedor em empresas como Videolog e Petrobras. Em 2015, foi um dos desenvolvedores de software mais notáveis no GitHub, tendo feito contribuições significativas para projetos de código aberto por 500 dias seguidos. Orador em mais de vinte conferências dando palestras sobre tecnologias web como JavaScript / ES6, Web Performance, React e Canvas / WebGL.
http://raphamorim.io
@raphamundi
- Patrocínio: Pipefy, Globo.com, Meteor, Apollo, Taller, Fullcircle, Quanto, Udacity, Cubos, Segware, Entria
- Apoio: Concrete, Rung, LuizaLabs, Movile, Rivendel, GreenMile, STQ, Hi Platform
- Promoção: InfoQ, DevNaEstrada, CodamosClub, JS Ladies, NodeBR, Training Center, BrazilJS, Tableless, GeekHunter
- Afterparty: An English Thing
Functional Programming for OO Programmers (part 1)Calvin Cheng
The Why and Benefits of Functional Programming paradigm. Part 2 with source code can be found here: http://www.slideshare.net/calvinchengx/functional-programming-for-oo-programmers-part-2
Related source code https://github.com/calvinchengx/learnhaskell
Since the introduction of C#, async/await concepts are still misunderstood by many developers.
Async programming tries to solve three problems (Offloading, Concurrency, Scalability) in a mean abstraction.
This presentation is a good starting point to asynchronous programming in .net. There are many links and references, so do not hesitate to go deeper.
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
Python is popular amongst data scientists and engineers for data processing tasks. The big data ecosystem has traditionally been rather JVM centric. Often Java (or Scala) are the only viable option to implement data processing pipelines. That sometimes poses an adoption barrier for organizations that have already invested in other language ecosystems. The Apache Beam project provides a unified programming model for data processing and its ongoing portability effort aims to enable multiple language SDKs (currently Java, Python and Go) on a common set of runners. The combination of Python streaming on the Apache Flink runner is one example. Let’s take a look how the Flink runner translates the Beam model into the native DataStream (or DataSet) API, how the runner is changing to support portable pipelines, how Python user code execution is coordinated with gRPC based services and how a sample pipeline runs on Flink.
Python is popular amongst data scientists and engineers for data processing tasks. The big data ecosystem has traditionally been rather JVM centric. Often Java (or Scala) are the only viable option to implement data processing pipelines. That sometimes poses an adoption barrier for organizations that have already invested in other language ecosystems. The Apache Beam project provides a unified programming model for data processing and its ongoing portability effort aims to enable multiple language SDKs (currently Java, Python and Go) on a common set of runners. The combination of Python streaming on the Apache Flink runner is one example. Let’s take a look how the Flink runner translates the Beam model into the native DataStream (or DataSet) API, how the runner is changing to support portable pipelines, how Python user code execution is coordinated with gRPC based services and how a sample pipeline runs on Flink.
This is an adaptation of the presentation given at the SpringOne 2008 conference in Hollywood, FL. It contains some updates on project status, and also information about the recently published book "Spring Python 1.1"
This slideshow is licensed under a Creative Commons Attribution 3.0 United States License.
Asynchronous programming is used anywhere where your application interacts with other external entities - be it other threads, other processes. This world by its nature is Asynchronous. Asynchronous literally means - anything can happen anytime - unpredictable. How do you write software through Asynchronous programming? That's what we shall be going to learn in this course. Big software projects of reasonable sizes are Asynchronous. Software projects leave their synchronous boundaries the moment it starts integrating and communicating with external entities or go multithreaded.
Asynchronous programming is widely used in Distributed Systems, Networking Protocols, Distributes Databases, etc.
The prerequisite of this Course :
Know Thread Synchronization Concepts - Mutexes and Condition Variables ( any thread library, but we will be using pthreads )
C or C++ in preferable, but if your fav language is any other mainstream language then also it is ok. Borrow the concepts and implement it in your fav language.
Comfortable with basic Data structures such as Linked-List.
Zeal to learn and excel - beyond what Crowd is doing ( DS/ALGO/CP )
The end product of this Course shall be a mini library yet very powerful library which allows you do develop software through Asynchronous programming.
Course Difficulty Level :
The Course is level is Intermediate to Advanced. Very beginners pls refrain from enrolling into the Course.
Software Designing Problems to Address in this Course :
Problem 1. Simulating Concurrency in Single-Threaded Programs
problem 2. Reducing Multi-threaded Programs to Single Threaded
Problem 3. Work Deferrals
Problem 4. Asynchronous Communication
Problem 5. Queuing and Processing Incoming Network Packets
Async/await and the Task model are the main features of C# 5/.NET 4.5. While asynchronous programming can be done in most languages, all have different specifics, usage and trade-offs. You will see, in this presentation, what is the asynchronous Task model in .NET and why it matters for web apps.
OpenAPI Specification 3.0 has become the de-facto standard for defining REST APIs. It is a descendant of Swagger and many people still know it by this name. It is a language/framework agnostic way of describing your APIs for both humans and machines. In this talk I will show an example OpenAPI spec document and run through it to demystify OAS. I will also quickly show some tools including my favourite VS Code that will help you in working with OAS. If you are either an API developer or API consumer or just want to be API savvy this talk is for you.
Deploying a website in Azure using ARM templatesPratik Khasnabis
Explains Azure Resource Management (ARM) templates with a sort demo of deploying a website to Microsoft Azure using ARM template and PowerShell. Presented at DDD by Night Melbourne, 2016
Show features introduced in C# 6.0 followed by a first look Into C# 7.0
A presentation at DDD Melbourne 2016 by @softveda. http://www.dddmelbourne.com/
DDD Melbourne 2014 security in ASP.Net Web API 2Pratik Khasnabis
My presentation at DDD Melbourne 2014 Conference on Security in ASP.Net Web API 2. Includes a brief introduction to OWIN and Katana.
http://www.dddmelbourne.com/
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Welcome to the first live UiPath Community Day Dubai! Join us for this unique occasion to meet our local and global UiPath Community and leaders. You will get a full view of the MEA region's automation landscape and the AI Powered automation technology capabilities of UiPath. Also, hosted by our local partners Marc Ellis, you will enjoy a half-day packed with industry insights and automation peers networking.
📕 Curious on our agenda? Wait no more!
10:00 Welcome note - UiPath Community in Dubai
Lovely Sinha, UiPath Community Chapter Leader, UiPath MVPx3, Hyper-automation Consultant, First Abu Dhabi Bank
10:20 A UiPath cross-region MEA overview
Ashraf El Zarka, VP and Managing Director MEA, UiPath
10:35: Customer Success Journey
Deepthi Deepak, Head of Intelligent Automation CoE, First Abu Dhabi Bank
11:15 The UiPath approach to GenAI with our three principles: improve accuracy, supercharge productivity, and automate more
Boris Krumrey, Global VP, Automation Innovation, UiPath
12:15 To discover how Marc Ellis leverages tech-driven solutions in recruitment and managed services.
Brendan Lingam, Director of Sales and Business Development, Marc Ellis
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
2. About Me Lead .Net Developer BUPA Australia Pratik Khasnabis Work For Tweet as C# Disclaimer: The opinions and viewpoints expressed in this presentation are my own and are not necessarily those of my employer, BUPA Australia. Solution Design @softveda WCF & SOA
3. What you will learn today ? Why is asynchronous programming important The Task-Based Asynchronous Pattern (TAP) Convert synchronous version of a code to asynchronous Using current pattern Using the new pattern Add Cancellation and Error Handling Add Progress Reporting
4. What you will NOT learn today ? The implementation details on how the pattern works Other features introduced in the CTP Concurrent programming using the TPL TPL Dataflow
6. Why Asynchronous ? Responsive UI Waiting on I/O or long computation will stop message processing and hang the app Becoming ubiquitous. JavaScript and Silverlight Responsive services Execute multiple operations simultaneously, receiving notifications when each completes Scalable. Serve many requests on a small pool of threads Do NOT block threads.
7. Threads are not the answer Thread creation is expensive Each managed thread takes 1MB of stack space Context switching is expensive Writing asynchronous methods is difficult Using callbacks for continuations Error handling, Cancellation, Progress Reporting is complicated Doesn’t feel natural How to be Asynchronous ?
8. Asynchronous Programming Model public class Stream { public intRead(byte[] buffer, intoffset, intcount); public IAsyncResultBeginRead(byte[] buffer, intoffset, intcount, AsyncCallbackcallback, object state); public intEndRead(IAsyncResultasyncResult); }
9. Event-Based Asynchronous Pattern public class Stream { public void ReadAsync(byte[] buffer, intoffset, intcount); public event ReadCompletedEventHandlerReadCompleted; } public delegate void ReadCompletedEventHandler(object sender, ReadCompletedEventArgseventArgs); public class ReadCompletedEventArgs: AsyncCompletedEventArgs { public intResult { get; } }
11. C# and VB.NetAsync CTP First introduced in PDC 2010 and the refresh in MIX 2011 (VS 2010 SP1) Introduces async and await contextual keywords in C# Available for Silverlight and Windows Phone 7 development as well Goal – Asynchronous programming should work as simply and intuitively as the synchronous version
13. Sync => Async Add reference to the Async CTP Library
14. Sync => Async Add asyncmodifier to the return types Change return type to Task<TResult> Add Async suffix to the method name Change to DownloadStringTaskAsync Add await keyword before the call of the Async method Keep doing this until we reach a void returning method up in the call hierarchy. Add asyncmodifier before the void
15. C# Async Features Asynchronous methods (and lambdas, and anonymous delegates) are a new feature in C# Asynchronous methods have an async modifier Asynchronous methods must return void, Task or Task<TResult> Asynchronous method names ends with an “Async” suffix by convention
16. C# AsyncFeatures, contd. Asynchronous methods can have small synchronous statements Asynchronous methods should have one or more await expressions inside it C# compiler does two things for an await expression 1. Creates a continuation for the rest of the method and assigns it to the Awaiter 2. Returns from the async method immediately after awaiting
17. C# Async Features, end. Asynchronous methods with void return type are fire-and-forget Cannot be awaited on Top level methods or event handlers Asynchronous methods with Task or Task<T> return type can be awaited They resume execution once the awaited task completes In between no thread is occupied Execution continues
18. Task-Based Async Pattern public class Stream { public Task<int> ReadAsync(byte[] buffer, intoffset, intcount); public Task<int>ReadAsync(byte[] buffer, intoffset, intcount, CancellationTokencancellationToken, IProgress<T>progress); }
19. Tracing the control flow Caller Void Async Method Task AsyncMethod Awaitable UI thread IOCP thread async void LoadPhotosAsync(string tag) { … var photosTask = GetPhotosAsync(tag, page); var photos = awaitphotosTask; DisplayPhotos(photos); } async Task<FlickrPhoto[]> GetPhotosAsync(string tag, int page) { WebClient client = new WebClient(); var IOTask = client.DownloadStringTaskAsync(…); var apiResponse = await IOTask; var photos = ParseResponse(apiResponse); return photos; } Button Click I/O Task 2 2 1 UI Task C1 Download Done C1 1 C1 C2 C2
20. Asynchronous ≠ Concurrent Hang UI Thread UI Messages DisplayPhotos Just One Thread !! DownloadDataAsync ParseResponse
21. Asynchronous ≠ Concurrent Asynchronous operations can share a single thread for multiple control flows The UI and IOCP threads are provided by the CLR or OS for free. Use them. Co-Operative multitasking. Wait for tasks to finish and yield control flow while awaiting. Task and Task<T> represents an operation that will return a result in “future”. Not tied to a thread.
22. Implementation The type of the expression awaited is based on a pattern satisfied by Task and Task<T> GetAwaiter/IsCompleted/OnCompleted/GetResult. C# compiler generates a state machine
23. Task-Based Async Pattern TAP methods return Task or Task<TResult> TAP methods ends with an “Async” suffix by convention TAP methods should have the same parameters as the synchronous one in the same order Avoid out and ref parameters Can have CancellationToken parameter Can have IProgress<T> parameter