AP 01/01 Asynchronous Calls Standard COM+ model is completely synchronous –Emulates standard procedure calls –Problematic in distributed scenarios with.

Slides:



Advertisements
Similar presentations
Three types of remote process invocation
Advertisements

How to Build Multi- threaded Applications in.NET Mazen S. Alzogbi Technology Specialist Microsoft Corporation.
COM vs. CORBA.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
I/O Multiplexing Road Map: 1. Motivation 2. Description of I/O multiplexing 3. Scenarios to use I/O multiplexing 4. I/O Models  Blocking I/O  Non-blocking.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
Intro to COM What is it and how do I use it?. Objectives Teach the fundamentals of COM. Understand the reason for using it. Learn to make a simple in-process.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Server Architecture Models Operating Systems Hebrew University Spring 2004.
II. Middleware for Distributed Systems
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
AP 01/01 Interface Definition Language Types are problematic: –Weakly typed C language: short / int / long –Architecture-specific data types IDL is a strongly.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
CHAPTER 3 The Component Object Model and DirectX © 2008 Cengage Learning EMEA.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Chapter 4: Threads. 4.2CSCI 380 Operating Systems Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Threads A thread (or lightweight process) is a basic unit of CPU.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Microsoft’s Distributed Component Object Model (DCOM) Jim Ries Updated 10/5/1999 A semi-technical overview.
COM/DCOM Implementation Basics of: Object creation and access Object Reuse Interface referencing.
DCOM-CORBA Comparison Operating Systems II Reference: P. Chung et al., DCOM and CORBA: side by side, step by step,and layer by layer, C++ Report.
COM and DCOM CS 562 February 27, Motivation Data Analyzer Resource Monitor int compute (…) { } int compute (…) { } Data Analyzer int compute (…)
CS 603 DCOM April 5, DCOM – What is it? Start with COM – Component Object Model –Language-independent object interface Add interprocess communication.
Information Management NTU Interprocess Communication and Middleware.
A COM implementation of the KSpace A ‘Knowledge Space prototype’ by Santhosh CST
Ni.com Understanding COM/ActiveX Jeff Paulter Staff Software Engineer Thurs Aug 17 10:15-11:30 a.m., 1:45-3:00 p.m. Ash (10A) Jeff Paulter Staff Software.
Introduction to COM and ActiveX Controls. What is an object? In the Fayad sense of the word.
Windows Network Programming ms-help://MS.MSDNQTR.2004JAN.1033/winsock/winsock/windows_sockets_start_page_2.htm 井民全.
CS 346 – Chapter 4 Threads –How they differ from processes –Definition, purpose Threads of the same process share: code, data, open files –Types –Support.
Li Tak Sing COMPS311F. Case study: consumers and producers A fixed size buffer which can hold at most certain integers. A number of producers which generate.
H.323, IP Multicast Conferencing, And TAPI 3.0 Don Ryan Development Lead Windows Networking And Communications Microsoft Corporation.
4061 Session 21 (4/3). Today Thread Synchronization –Condition Variables –Monitors –Read-Write Locks.
Sound DirectMusic & DirectSound. DirectShow Video Formats DirectShow is an open architecture, it can support any format as long as there are filters to.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Synchronizing threads, thread pools, etc.
Threaded Programming in Python Adapted from Fundamentals of Python: From First Programs Through Data Structures CPE 401 / 601 Computer Network Systems.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Lecture 3 Threads Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Seminarium on Component-based Software Engineering Feraaz Imami LIACS – Leiden University Fall 2005 Component Object Model (COM)
Threading in COM What is an Apartment and Why Do I Care?
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Microsoft Consumer Channels and Central Marketing Group
.NET Mobile Application Development XML Web Services.
CEN6502, Spring Understanding the ORB: Client Side Structure of ORB (fig 4.1) Client requests may be passed to ORB via either SII or DII SII decide.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Component Object Model(COM)
OPERATING SYSTEM CONCEPT AND PRACTISE
Chapter 4: Threads.
Putting the Distributed into COM
Microsoft’s Distributed Component Object Model (DCOM)
Out-of-Process Components
C# COM Interoperability Late Binding
Knowledge Byte In this section, you will learn about:
Interpreter Style Examples
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
DCOM-CORBA Comparison
Multithreaded Programming
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Distribution Infrastructures
Out-of-Process Components
Lecture 7 ATL and Out-of-Process Components
Presentation transcript:

AP 01/01 Asynchronous Calls Standard COM+ model is completely synchronous –Emulates standard procedure calls –Problematic in distributed scenarios with high network latencies Use threads to handle multiple calls asynchronously –Efficiency might be limited –Synchronization of multiple threads may be difficult Idea: support asynchronous calls by infrastructure –COM+ starts call and returns to client immediately –Call object can be used to obtain results later –Language constructs like futures support this approach –Works currently under Windows 2000 only

AP 01/01 Defining Asynchronous Interfaces New IDL attribute [async_uuid] –MIDL generates both, synchronous and asynchronous version of IF [object, uuid( AAAA A ), async_uuid( AAAA B )] Interface IPrime : IUnknown { HRESULT IsPrime(int num, [out, retval] int * v); } Methods are split into two for asynch. Interface Begin_method accepts all [in], [in, out] parameters Finish_method accepts all [out], [in, out] parameters

AP 01/01 Asynchronous Interface generated by MIDL MIDL_INTERFACE(“ AAAA B “) AsynchPrime : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Begin_IsPrime( int testnumber ) = 0; virtual HRESULT STDMETHODCALLTYPE Finish_IsPrime( /* out, retval */ int __RPC_FAR *v) = 0; }; New registry entries for asynchronous interfaces: –AsynchronousInterface subkey under IID of synchronous interface

AP 01/01 Calling Asynchronous Interfaces To begin an asynchronous call 1.Query the server object for the ICallFactory interface. If QueryInterface returns E_NOINTERFACE, the server object does not support asynchronous calling. 2.Call ICallFactory::CreateCall to create a call object corresponding to the interface you want, and then release the pointer to ICallFactory. 3.If you did not request a pointer to the asynchronous interface from the call to CreateCall, query the call object for the asynchronous interface. 4.Call the appropriate Begin_ method. interface ICallFactory : IUnknown { HRESULT CreateCall( [in] REFIID riid, [in] IUnknown *pCtrlUnk, [in] REFIID riid2, [out, iid_is(riid2)] IUnkown **ppv); }

AP 01/01 Client makes asynchronous call IPrime * pPrime = 0; CoCreateInstance( CLSID_Prime, 0, CLSCTX_LOCAL_SERVER, IID_IPrime, (void **) &pPrime; ICallFactory* pCallFactory = 0; pPrime->QueryInterface(IID_ICallFactory, (void **) &pCallFactory); AsyncIPrime* pAsyncPrime = 0; pCallFactory->CreateCall(IID_AsyncIPrime, 0, IID_AsyncIPrime, (IUnknown**) &pAsyncPrime); pAsyncPrime->Begin_IsPrime(number); int result = 0; // do other work here pAsyncPrime->Finish_IsPrime(&result); if (result) printf(“%d is prime\n“, number ); pAsyncPrime->Release(); pCallFactory->Release(); pPrime->Release();

AP 01/01 Asynchronous Calls (contd.) A call object can process only one asynchronous call at a time. –If the same or a second client calls a Begin_ method before a pending asynchronous call is finished, the Begin_ method will return RPC_E_CALL_PENDING. If the client does not need the results of the Begin_ method, it can release the call object at the end of this procedure. –COM detects this condition and cleans up the call. The Finish_ method is not called, and the client does not get any out parameters or a return value. When the server object is ready to return from the Begin_ method, it signals the call object that it is done. –When the client is ready, it checks to see if the call object has been signaled. –If so, the client can complete the asynchronous call.

AP 01/01 Finishing an asynchronous call The mechanism for this signaling and checking between client and server is the ISynchronize interface on the call object. –The call object normally implements this interface by aggregating a system- supplied synchronization object. –The synchronization object wraps a Win32 event handle, which the server signals just before returning from the Begin_ method by calling ISynchronize::Signal. To complete an asynchronous call 1.Query the call object for the ISynchronize interface. 2.Call ISynchronize::Wait. 3.If Wait returns RPC_E_TIMEOUT, the Begin_ method is not finished processing. The client can continue with other work and call Wait again later. It cannot call the Finish_ method until Wait returns S_OK. 4.If Wait returns S_OK, the Begin_ method has returned. Call the appropriate Finish_ method.

AP 01/01 The ISynchronize Interface interface ISynchronize : IUnknown { // waits for the synchronization object to be signaled // or for a specified timeout period to elapse, whichever // comes first HRESULT Wait([in] DWORD dwFlags, [in] DWORD dwMillisec ); // sets synchronization object‘s state to signaled HRESULT Signal(); // resets synchronization object to non-signaled state HRESULT Reset(); }

AP 01/01 Interoperability Asynchronous and synchronous IF are considered as two parts of the same interface –Although they have different unique IIDs –What happens if component implements synchronous IF only? If component implements synch IF only... –COM+ infrastructure automatically supports ICallFactory interface in the proxy (standard marshaling) –Maps async calls to synch interface (Begin_...) –Proxy holds values of synch call until client calls Finish_... If component implements both versions of IF... –Duplication of code -> Components need only support asynch IF... –COM+ infrastructure maps synchronous calls to asynch version of IF