CIS 330 -.NET Applications1 Chapter 7 – Asynchronous Calls.

Slides:



Advertisements
Similar presentations
Generalized Requests. The current definition They are defined in MPI 2 under the hood of the chapter 8 (External Interfaces) Page 166 line 16 The objective.
Advertisements

How to Build Multi- threaded Applications in.NET Mazen S. Alzogbi Technology Specialist Microsoft Corporation.
Asynchronous Web Services Jaliya N. Ekanayake. Basics of Web Services.
D u k e S y s t e m s Servers and Threads Jeff Chase Duke University.
Concurrency 101 Shared state. Part 1: General Concepts 2.
Chapter 14 Multithreading Yingcai Xiao. Multithreading is a mechanism for performing two or more tasks concurrently.  In the managed world of the common.
ASP.Net, web services--- asynchronous and synchronous and AJAX By Thakur Rashmi Singh.
Chapter 7 Protocol Software On A Conventional Processor.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
Chapter 6 Horstmann Programs that make decisions: the IF command.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
CS220 Software Development Lecture: Multi-threading A. O’Riordan, 2009.
.NET Mobile Application Development Concurrency in Distributed Clients.
Chapter 11 Operating Systems
The Globus Toolkit V4.0 WSRF-C Performance Aspects Sam Lang, ANL GlobusWORLD 10 Feb 2005.
Object-Oriented Programming with Java Lecture 2 The Java Event Model.
1 I/O Management in Representative Operating Systems.
Asynchronous Web Services Approach Enrique de Andrés Saiz.
Workflow Framework There are many open-source workflow frameworks available such as: –OS Workflow -
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Problems with Send and Receive Low level –programmer is engaged in I/O –server often not modular –takes 2 calls to get what you want (send, followed by.
Workflow Early Start Pattern and Future's Update Strategies in ProActive Environment E. Zimeo, N. Ranaldo, G. Tretola University of Sannio - Italy.
New features for CORBA 3.0 by Steve Vinoski Presented by Ajay Tandon.
1 Web Based Programming Section 8 James King 12 August 2003.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
Mahapatra-A&M-Fall'001 Co-design Finite State Machines Many slides of this lecture are borrowed from Margarida Jacome.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
Slide 1 Asynchronous Composition Pyounguk Cho, Oracle Corporation.
Internet Software Development Controlling Threads Paul J Krause.
ADVANCED WEB SERVICES. Three Advanced Web Service Techniques SOAP Extensions Asynchronous calls Custom wire formatting SOAP Extensions Asynchronous calls.
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH ASP.NET developers, including Web Forms & MVC History of async programming in.NET How async.
SOA-10: Event-Driven SOA: EDA in an SOA World Ken Wilner Vice President of Technology.
Update on CORBA Support for Babel RMI Nanbor Wang and Roopa Pundaleeka Tech-X Corporation Boulder, CO Funded by DOE OASCR SBIR.
Lecture 8 Page 1 CS 111 Online Other Important Synchronization Primitives Semaphores Mutexes Monitors.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
15.1 Threads and Multi- threading Understanding threads and multi-threading In general, modern computers perform one task at a time It is often.
COMPSCI 230 S2C 2015 Software Design and Construction Synchronization (cont.) Lecture 4 of Theme C.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Ideas from ARC about the CORBA FL interface Interface ideas learned from K9 and K10 (Lorenzo) CORBA usage and wrapping ideas learned from MIRO (Hans)
Module 8 Enhancing User Interface Responsiveness.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Lecture 6: Monitors & Semaphores. Monitor Contains data and procedures needed to allocate shared resources Accessible only within the monitor No way for.
1 OS Review Processes and Threads Chi Zhang
.NET Mobile Application Development XML Web Services.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
1.NETDelegates & eventsNOEA / PQC 2007 Delegates & events Observer pattern Delegates –Semantics –Cil – code –Usage Events Asynchronious delegates.
L6: Threads “the future is parallel” COMP206, Geoff Holmes and Bernhard Pfahringer.
Adding Non-blocking Requests Contribution: oneM2M-ARC-0441R01R01 Source: Josef Blanz, Qualcomm UK, Meeting Date: ARC 7.0,
CIS NET Applications1 Chapter 8 – Multithreading and Concurrency Management.
SPL/2010 Reactor Design Pattern 1. SPL/2010 Overview ● blocking sockets - impact on server scalability. ● non-blocking IO in Java - java.niopackage ●
Services. What is a Service? A Service is not a separate process. A Service is not a thread. A Service itself is actually very simple, providing two main.
Threads Some of these slides were originally made by Dr. Roger deBry. They include text, figures, and information from this class’s textbook, Operating.
Lecture 6 Threads Erick Pranata
Message-Passing Communication Analyzer By Poonam Bijlani CSE 775- Distributed Objects Prof. Jim Fawcett.
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Jim Fawcett CSE681 – Software Modeling & Analysis Fall 2002
Outline Other synchronization primitives
Object-Oriented Network Communication (OOMI)
Other Important Synchronization Primitives
Asynchronous Programming
Multithreading.
COMP60621 Fundamentals of Parallel and Distributed Systems
Programming with Shared Memory
Slide design: Dr. Mark L. Hornick
CS561 Computer Architecture Hye Yeon Kim
COMP60611 Fundamentals of Parallel and Distributed Systems
Parallel Programming with ForkJoinPool Tasks in Java
Presentation transcript:

CIS NET Applications1 Chapter 7 – Asynchronous Calls

CIS NET Applications2 Objectives Asynchronous System Requirements.NET Asynchronous Implementation

CIS NET Applications3 Modern Asynchronous Requirements Components should support both synchronous and asynchronous calls Clients should be able to select either call mode Clients should be able to issue multiple asynchronous calls Components should be able to serve multiple concurrent calls All component method output parameters or return values must be accessible by clients Errors on the component side should have a way to be propagated back to the client Asynchronous calls should be straightforward and simple to use, e.g., implementation details should be hidden

CIS NET Applications4 Client Choices Perform work while call is in progress, then block until completion Perform work while call is in progress, then poll for completion Perform work while call is in progress, wait for a predetermined amount of time, then stop waiting, even if the method execution has not yet completed Wait simultaneously for completion of multiple methods. Client can choose to wait for all or any of the pending calls to complete Receive notifications when the method has completed. The notification will be in the form of a callback on the client- provided method

CIS NET Applications5 Asynchronous Call Programming.NET utilizes a thread pool to manage all asynchronous calls.NET used two predefined methods –BeginInvoke(): initiates an asynchronous method call –EndInvoke(): manages method completion – namely retrieving output parameters, return values, and error handling.NET uses delegates All.NET classes support asynchronous invocation

CIS NET Applications6 Simple Asynchronous execution Sequence Calculator calculator = new Calculator(); BinaryOperations oppDel = calculator.Add; IAsyncResult asyncResult1 = oppDel.BeginInvoke(2,3,null,null); IAsyncResult asyncResult2 = oppDel.BeginInvoke(4,5,null,null); // do some work int result; result = oppDel.EndInvoke(asyncResult1); //may block Console.WriteLine (“Result = {0}“,result); result = oppDel.EndInvoke(asyncResult2); Console.WriteLine ((“Result = {0}“,result);

CIS NET Applications7 Using IAsyncResult.AsyncWaitHandle Calculator calculator = new Calculator(); BinaryOperations oppDel = calculator.Add; IAsyncResult asyncResult = oppDel.BeginInvoke(2,3,null,null); while (asyncResult.IsCompleted == false) //polling { asyncResult.AsyncWaitHandle.WaitOne(10,false); // do some work } int result; result = oppDel.EndInvoke(asyncResult1); //will not block Console.WriteLine (“Result = {0}“,result);

CIS NET Applications8 Using Completion Callback Methods Public class CalculatorClient { public void AsyncAdd() { Calculator calculator = new Calculator(); BinaryOperations oppDel = calculator.Add; oppDel.BeginInvoke(2,3,OnMethodCompletion,null); } void OnMethodCompletion(IAsyncResult asyncResult) { int result = 0; AsyncResult resultObj = (AsyncResult)asyncResult; Debug.assert(resultObj.EndInvokeCalled = false); BinaryOperation oppDel = (BinaryOperation)resultObj.AsyncDelegate; result = oppDel.EndInvoke(asyncResult1); //will not block Console.WriteLine (“Result = {0}“,result); }

CIS NET Applications9 Completion Callback Model Preferred model for event-driven applications Event-driven applications –Has methods that trigger events and methods that handle these events –Easier to manage multiple threads, events, and messages –Greater scalability, responsiveness, and performance Waiting, blocking, and polling are for applications that are strict, predictable, and deterministic Callback methods must be reentrant and thread-safe

CIS NET Applications10 Summary Asynchronous System Requirements.NET Asynchronous Implementation