Professional ASP.NET Web Services : Asynchronous Programming
|
|
- Julius Underwood
- 5 years ago
- Views:
Transcription
1 Professional ASP.NET Web Services : Asynchronous Programming To wait or not to wait; that is the question! Whether or not to implement asynchronous processing is one of the fundamental issues that a developer must answer when invoking function calls across process boundaries. Given that the option to invoke an asynchronous call is available, the programmer has to weigh the relative ease of coding synchronous calls with its inherent drawback - when a synchronous call is made, the calling thread is blocked and has to wait until the function completes. In many instances, this is an acceptable shortcoming, as in the case when a program's logic flow should not continue until data is retrieved from a database. Asynchronous processing, on the other hand, allows more parallelism. A thread that initiates an asynchronous call is not blocked and can therefore do almost any computation while the method is in transit. The case for asynchronous processing becomes very compelling in the enterprise computing space where systems need to handle hundreds of thousands of function call requests and synchronicity may become a barrier to scalability. Web Services support both synchronous and asynchronous communication between the client application and the server hosting the service. Since both are supported, the developer is challenged with deciding which type of process to initiate in their application. In this chapter, we're going to dive into the subject of synchronous and asynchronous programming as it pertains to ASP.NET Web Services. We'll explore the mechanics of invoking Web Services via an asynchronous mechanism. We'll also look into the.net framework and how it provides the infrastructure for asynchronous processing. So, the topics for this tutorial are: Synchronous versus asynchronous invocations Asynchronous design patterns in.net How to invoke Web Services asynchronously Synchronous Versus Asynchronous Invocations : In this section, we'll compare the merits and shortcomings of both the synchronous and asynchronous approaches to calling Web Services. We'll also learn how to actually develop client applications that make use of the asynchronous mechanisms built into the.net framework. This will set the stage for a deeper discussion of asynchronous processing in the subsequent sections. 1
2 The Case for Synchronous Processing : Synchronous operations consist of component or function calls that operate in lockstep. A synchronous call blocks a process until the operation completes. Only then will the next line of execution be invoked. There are many examples in life that model this pattern of behavior. The cafeteria line at your local restaurant, for example, behaves in a synchronous fashion. Customers are serviced one at a time. While they are in line, they are blocked from conducting other activities, and they wait until all their food choices are served before they can continue with their lunch-break. Of course, after waiting for a very long time they might give up and leave. As you can see, the procedure for making synchronous calls is straightforward: 1. The client obtains an interface pointer to the server object and calls a method through that pointer 2. The client waits until the server either completes the method call, or if there is no response for a given period of time the client raises an error 3. Only after the method call returns is the client free to continue with its processing It is this simplicity that makes synchronous processes a compelling choice. Most of the time, the performance achieved from method calls is acceptable and does not warrant the extra overhead required for concurrent processing. In fact, most of the function calls in the.net framework are synchronous to minimize problems that can arise from asynchronous message processing. Likewise, the method calls you will be implementing will be done in a synchronous fashion in most cases. Asynchronous message passing, on the other hand, is more difficult to code and introduces several problems. What happens if the method call is not delivered to the server object successfully? The calling process does not wait for delivery of the message, and thus never hears about the error. The operating system has to provide the infrastructure for reporting such errors, or worse, the programmer may have to write special code to handle such cases. Another related problem is how will the calling application discover the completion of the called function? The application will either have to create a polling mechanism, event trigger, or callback method in order to be later notified of the operation. Because synchronous messaging is so easy to implement, you may be tempted to take the simple route and always use a synchronous mechanism when invoking a Web Service from your client code. 2
3 Consider your choice carefully because this decision will have an impact on how your client application will perform. When implemented properly, using asynchronous communication may improve system usage and avoid delays on the client side, while waiting for the Web Service results. When Asynchronous Processing Is Better : When method calls are invoked across process and machine boundaries via an RPC mechanism, it's oftentimes a likely candidate for asynchronous processing. This is definitely true in the case of Web Services where the remote procedure call is sent via HTTP and must deal with issues such as bandwidth constraints and network latency. What makes asynchronous method invocations a good choice for communicating with Web Services? An asynchronous operation will not block the calling thread, which only initiates the operation. The calling application must then discover completion of the call by polling, by software interrupt, or by waiting explicitly for completion later. An asynchronous operation will need to return a call or transaction ID if the calling application needs to be later notified about the operation. At notification time, this ID would be placed in some global location or passed as an argument to a handle or wait call. The procedure for making an asynchronous call is not as simple as its synchronous counterpart: 1. The client obtains an interface pointer to the server object and calls the method asynchronously. The client includes a function pointer to a sink object for message callback. 2. The call returns immediately and the calling thread is free to execute the next line of code. 3. When the method is finished processing the request, the server notifies the client through the callback routine in the sink object. Even with advancements implemented in the.net framework, successfully developing asynchronous programming logic is not trivial. You need to examine the requirements of your application carefully to determine whether or not the code you're writing can even benefit from asynchronous events. Here are some general guidelines to consider when making your decision: Consider asynchronous processing if the calling thread controls a Windows user interface. In this case, the calling 3
4 thread can't afford to be blocked during a remote method call because the UI will freeze. Asynchronous processing may help with scalability if the Web Services client is an ASP.NET application or another ASP.NET Web Service. In this scenario, a blocked synchronous call in the code can stall the ASP.NET worker thread, which can force other applications' requests to queue and, therefore, impact scalability. Using asynchronous communication instead could at least free up the threads that ASP.NET isn't using for the Web Service calls. Asynchronous server processing is discussed in detail towards the end of this chapter. If there is a possibility that the remote procedure call to the Web Service may take a while to complete, asynchronous processing may be beneficial. In this case the client application can do other work on the thread before it needs the results from the remote procedure call. The client application may need to make concurrent calls to one or more remote services. In this case, using an asynchronous remote procedure call is much better than spinning off multiple threads to do the same work. For example, if an application needs to make concurrent synchronous calls to three different Web Services, it cannot do so with one thread. It has to spin off at least two threads and make a remote call in each thread. However, if the client uses an asynchronous remote call, it can make all three calls on one thread and then wait for all of them. A Sample Web Service : Now that we've discussed the pros and cons of both the synchronous and asynchronous programming methodologies, let's write some code to illustrate the concepts. We'll begin by creating an ASP.NET Web Service that our client application can invoke. We'll then create two separate applications, with one calling the Web Service synchronously, and the other asynchronously, so that we can compare the techniques of each approach. For the purposes of our discussion, we will be making use of an ASP.NET Web Service that returns a stock quote. The Web Service, named StockService, accepts a ticker symbol parameter that will return a string representing the value of the stock. In order to properly demonstrate asynchronous programming, the Web Service we will be invoking will also have the ability to simulate a longrunning process. For that purpose, the StockService example accepts another parameter that represents the number of seconds the service will wait before returning the stock value back to the calling application. Figure 1 is a screenshot of the StockService.asmx page displaying the GetStockQuote method. 4
5 Figure 1: StockService Test Page The TickerSymbol parameter will accept a string value representing a stock symbol or a company name. The DelayInSeconds parameter will accept an integer value representing the number of seconds the Web Service will wait before returning the stock's value. Below is the code for the StockService Web Service written in C#. Bear in mind that this Web Service is simply a simulation for illustrative purposes only and obviously doesn't return accurate stock values. The actual algorithm that a production Web Service would use to return a stock's actual value will be much more complex than this example. Listing1 StockService Codes using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; namespace StockService /// <summary> /// Summary description for Service1. /// </summary> public class StockService : System.Web.Services.WebService 5
6 public StockService() //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); #region Component Designer generated code //Required by the Web Services Designer private IContainer components = null; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) if(disposing && components!= null) components.dispose(); base.dispose(disposing); #endregion [WebMethod] public string GetStockQuote(String TickerSymbol, int DelayInSeconds) //Create a delay to simulate a long-running process if (DelayInSeconds > 0) // Have the thread sleep based on the DelayInSeconds parameter // Note: The constant "1000" is to convert seconds to milliseconds System.Threading.Thread.Sleep(DelayInSeconds * 1000); // Retrieve the stock quote based on the TickerSymbol parameter // NOTE: Stock values are for simulation purposes only string Quote; switch (TickerSymbol.ToUpper()) case "MSFT": Quote = "67"; break; case "SUNW": Quote = "70"; 6
7 break; case "IBM": Quote = "100"; break; default: Quote = "Unknown"; break; return Quote; The Web Service has one method, GetStockQuote. GetStockQuote accepts the two parameters we previously discussed: TickerSymbol and DelayInSeconds. [WebMethod(Description="Returns a stock quote")] public string GetStockQuote(string TickerSymbol, int DelayInSeconds) The GetStockQuote method returns a string, which represents the value of the requested stock. The method will return a string value of "Unknown" if the stock's value is not known. Additionally, this method has the functionality to delay the delivery of the return message to simulate a long server-side process. The code accomplishes this by retrieving a handle to the current thread and causes the thread to sleep for the duration specified in the DelayInSeconds parameter: //Have the thread sleep based on the DelayInSeconds parameter //Note: The constant "1000" is to convert seconds to milliseconds System.Threading.Thread.Sleep(DelayInSeconds * 1000); Figure2 is the output of the GetStockQuote method when invoked from the sample page provided by ASP.NET: 7
8 Figure 2: Stock Service Result Page You will notice in our sample Web Service that there is nothing specific in the implementation of StockService that provides asynchronous functionality. It's actually the calling application that will decide if a particular call should be asynchronous. This is in keeping with one of the tenets of the.net framework, which states that it's not necessary for a called object to do additional programming to support asynchronous behavior by its clients. In fact, the called object doesn't even have to be an ASP.NET Web Service. It could be a Web Service developed on another platform and we would still be able to invoke an asynchronous call from a client running on the.net framework. The generated C# proxy class contains both synchronous and asynchronous versions of the GetStockQuote method. The asynchronous version consists of two methods, a BeginGetStockQuote and an EndGetStockQuote method. The BeginGetStockQuote method is used to initiate the call to the Web Service, while the EndGetStockQuote method retrieves the results. We'll take a closer look at this proxy class in the "Asynchronous Programming in.net" section of this chapter. 8
9 Using the Sample Web Service : Now let's have some fun by invoking this Web Service from a client application both, synchronously and asynchronously. The client will be developed as a console application using Visual Studio.NET. A Sample Synchronous Method Call : The code for calling a Web Service synchronously should be relatively familiar by now, since many of the examples in this book have been synchronous remote procedure calls to Web Services. This example will be no different. Here's the C# code for the console application, SyncStockClient.exe in the bin subfolder of the SyncStockClient folder in the download, that uses the StockService Web Service: Listing2 SyncStockClient Codes using System; namespace SyncStockClient /// <summary> /// Summary description for Class1. /// </summary> class SyncStockClient /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) // // TODO: Add code to start application here // String ReturnValue; // create the web service instance via the proxy class localhost.stockservice objstockservice = new localhost.stockservice(); array arguments service // Make sure there are at least two items in args[] // NOTE: the args[] array contains command line if (args.getupperbound(0) >= 1) // Invoke the synchronous call to the web // This thread is block until the method call returns // with the return value // NOTE: System.Convert.ToInt32 converts the string // argument to integer ReturnValue = objstockservice.getstockquote(args[0], 9
10 System.Convert.ToInt32(args[1])); // Display the results to the user Console.WriteLine("Stock quote for " + args[0] + " is " + ReturnValue); else // User did not enter the right number of parameters Console.WriteLine("You need to input 2 parameters. Try again."); SyncStockClient.exe is designed to be used at the command prompt. This application accepts two command-line parameters that will then be passed to the GetStockQuote method call of the StockService Web Service. Here's the line of code that invokes the Web Service method: ReturnValue = objstockservice.getstockquote(args[0], System.Convert.ToInt32(args[1])); When the application starts, the command-line is parsed by the GetCommandLineArgs method and the command-line entries are then stored in the args array. When the user starts the application correctly, args[0] will contain the StockSymbol parameter and args[1] will contain the DelayInSeconds parameter. Below is the output for SyncStockClient.exe: Since the Web Service call, in this example, is synchronous, the application has no choice but to wait for the processing to conclude 10
11 before running the next line of execution, which then prints the outcome of the method call. Let's now look at a similar application that calls StockService asynchronously. A Sample Asynchronous Method Call : This next example will also be a console-based application written in Visual Basic.NET. It's identical in functionality to SyncStockClient.exe with the exception that the GetStockQuote method will be invoked asynchronously. Here's the C# code for the console application, AsyncStockClient.exe, that uses the StockService Web Service: Listing2 AsyncStockClient Code using System; namespace AsyncStockClient /// <summary> /// Summary description for Class1. /// </summary> class AsyncStockClient /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) // // TODO: Add code to start application here // string ReturnValue; IAsyncResult AsyncResult; // Create the web service instance via the proxy class localhost.stockservice objstockservice = new localhost.stockservice(); if (args.getupperbound(0) >= 1) // Invoke the asynchronous call to the Web Service AsyncResult = objstockservice.begingetstockquote(args[0], System.Convert.ToInt32(args[1]), null, null); processing while loop // Method call returns right away // This thread is free to do more // Check for method completion in the 11
12 do more processing"); Console.Write("I'm not blocked. I can while (AsyncResult.IsCompleted == false) Console.Write("."); returned!"); Console.WriteLine("Method call has ReturnValue = objstockservice.endgetstockquote(asyncresult); Console.WriteLine("Stock quote for " + args[0] + " is " + ReturnValue); else Console.WriteLine("You need to input 2 parameters. Try again."); The call to BeginGetStockQuote starts the asynchronous communication process, sending out the method request and then returning immediately. The return value of this method call is not yet the actual stock quote, yet, as was the case in the synchronous version. Instead, it's an object of type IAsyncResult, which is part of the System.Runtime.Remoting.Messaging namespace. The AsyncResult object will be used later to poll for completion and to fetch the results of the method call: //Invoke the asynchronous call to the Web Service //NOTE: System.Convert.ToInt32 converts the string argument to integer AsyncResult = objstockservice.begingetstockquote(args[0], System.Convert.ToInt32(args[1]), null, null); The parameter list of the BeginGetStockQuote begins with the parameters of the synchronous method - StockSymbol and DelayInSeconds. The method has two additional parameters used in providing a callback mechanism for the asynchronous process. Since we won't be using a callback mechanism in this example, the C# code simply passes null to the last two parameters (we'll be covering the callback mechanism in a later example in this chapter). Once the Web Service method has been invoked asynchronously, the calling thread needs a way to find out when the operation has completed. The IAsyncResult class contains a property for just this purpose, called IsCompleted, which will return the Boolean value, 12
13 true, when the Web Service is finished processing the request. In the code, outlined below, we call the AsyncResult.IsCompleted method periodically to check for method call completion. //Method call returns right away! //This thread is free to do more processing //Check for method completion in the while loop Console.Write("I'm not blocked. I can do more processing"); while(asyncresult.iscompleted == false) Console.Write("."); To retrieve the results of the operation, we call the EndGetStockQuote method provided by the Web Service's proxy class: //Retrieve return value from the Web Service ReturnValue = objstockservice.endgetstockquote(asyncresult); The method accepts one parameter of type IAsyncResult. In this case, we pass the AsyncResult object that we originally received from the BeginGetStockQuote method. This is how the.net infrastructure is able to determine which result to give back to our code, since the client may have invoked any number of requests at the same time. Note that we need to wait for the AsyncResult.IsCompleted to return true before invoking the EndGetStockQuote method. If we call the EndGetStockQuote method before the operation is finished, it will block until the operation does in fact complete. In this example, the user starts the AsyncStockClient application, requesting the stock quote for Microsoft (MSFT) and setting a server-side delay of 5 seconds: 13
14 Since the Web Service call in this example, is asynchronous, the method call returns immediately and the calling thread is free to do more processing. In this case, the calling thread writes to the console to demonstrate that it's able to do more work: I'm not blocked. I can do more processing... At the same time, the client application is polling to check if the method call has returned. Upon completion of the call request, the client then prints the outcome of the method call: Method call has returned! Stock quote for msft is 67 Reference: Wrox Press, Professional ASP. NET Web Services: Asynchronous Programming, &page=1 14
The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further technical information about EPiServer.
Web Services Product version: 4.50 Document version: 1.0 Document creation date: 04-05-2005 Purpose The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further
More informationEvent-based Asynchronous Pattern Overview 1 Implementing the Event-based Asynchronous Pattern 5 Deciding When to Implement the Event-based
Event-based Asynchronous Pattern Overview 1 Implementing the Event-based Asynchronous Pattern 5 Deciding When to Implement the Event-based Asynchronous Pattern 12 Implementing Component with the Event-based
More informationAsynchronous Programming Model (APM) 1 Calling Asynchronous Methods Using IAsyncResult 4 Blocking Application Execution by Ending an Async Operation
Asynchronous Programming Model (APM) 1 Calling Asynchronous Methods Using IAsyncResult 4 Blocking Application Execution by Ending an Async Operation 5 Blocking Application Execution Using an AsyncWaitHandle
More informationWeb Services in.net (2)
Web Services in.net (2) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial
More informationWeb Services in.net (6)
Web Services in.net (6) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial
More informationC# Asynchronous Programming Model
Spring 2014 C# Asynchronous Programming Model A PRACTICAL GUIDE BY CHRIS TEDFORD TABLE OF CONTENTS Introduction... 2 Background Information... 2 Basic Example... 3 Specifications and Usage... 4 BeginInvoke()...
More informationSri Lanka Institute of Information Technology System Programming and Design II Year 3 Tutorial 06
Sri Lanka Institute of Information Technology System Programming and Design II Year 3 Tutorial 06 1. What is an asynchronous call? How does it differ from a synchronous call? In synchronous call, the caller
More informationTutorial 5 Completing the Inventory Application Introducing Programming
1 Tutorial 5 Completing the Inventory Application Introducing Programming Outline 5.1 Test-Driving the Inventory Application 5.2 Introduction to C# Code 5.3 Inserting an Event Handler 5.4 Performing a
More informationClasses in C# namespace classtest { public class myclass { public myclass() { } } }
Classes in C# A class is of similar function to our previously used Active X components. The difference between the two is the components are registered with windows and can be shared by different applications,
More informationWeb Services in.net (6) cont d
Web Services in.net (6) cont d These slides are meant to be for teaching purposes only and only for the students that are registered in CSE3403 and should not be published as a book or in any form of commercial
More informationการสร างเว บเซอร ว สโดยใช Microsoft.NET
การสร างเว บเซอร ว สโดยใช Microsoft.NET อ.ดร. กานดา ร ณนะพงศา ภาคว ชาว ศวกรรมคอมพ วเตอร คณะว ศวกรรมคอมพ วเตอร มหาว ทยาล ยขอนแก น บทน า.NET เป นเคร องม อท เราสามารถน ามาใช ในการสร างและเร ยกเว บเซอร ว สได
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),
More informationTutorial 19 - Microwave Oven Application Building Your Own Classes and Objects
1 Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline 19.1 Test-Driving the Microwave Oven Application 19.2 Designing the Microwave Oven Application 19.3 Adding a New
More informationPatterns for Asynchronous Invocations in Distributed Object Frameworks
Patterns for Asynchronous Invocations in Distributed Object Frameworks Patterns for Asynchronous Invocations in Distributed Object Frameworks Markus Voelter Michael Kircher Siemens AG, Corporate Technology,
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationIn order to create your proxy classes, we have provided a WSDL file. This can be located at the following URL:
Send SMS via SOAP API Introduction You can seamlessly integrate your applications with aql's outbound SMS messaging service via SOAP using our SOAP API. Sending messages via the SOAP gateway WSDL file
More informationTutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic
Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic Outline 6.1 Test-Driving the Enhanced Inventory Application 6.2 Variables 6.3 Handling the TextChanged
More informationOGSI.NET UVa Grid Computing Group. OGSI.NET Developer Tutorial
OGSI.NET UVa Grid Computing Group OGSI.NET Developer Tutorial Table of Contents Table of Contents...2 Introduction...3 Writing a Simple Service...4 Simple Math Port Type...4 Simple Math Service and Bindings...7
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution
More informationDeveloping Microsoft Azure and Web Services. Course Code: 20487C; Duration: 5 days; Instructor-led
Developing Microsoft Azure and Web Services Course Code: 20487C; Duration: 5 days; Instructor-led WHAT YOU WILL LEARN In this course, students will learn how to design and develop services that access
More informationDo not start the test until instructed to do so!
CS 3204 Operating Systems Midterm (Abrams) Spring 2004 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PRO SI M UNI VERSI TY Instructions: Do not start the test until instructed to do so! Print your name
More informationHierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationContact information: Aanderaa Data Instruments AS PO BOX 34, Slåtthaug 5851 Bergen, NORWAY TEL: FAX:
Page 2 January 2009 TD278 AADI Real-Time Programming Reference 1 st Edition 30 September 2007 PRELIMINARY EDITION 2 nd Edition 15 Jannuary 2009 Comment [JLH1]: Must be updated Copyright: Aanderaa Data
More informationDefinition: A thread is a single sequential flow of control within a program.
What Is a Thread? All programmers are familiar with writing sequential programs. You've probably written a program that displays "Hello World!" or sorts a list of names or computes a list of prime numbers.
More informationBEAWebLogic Server. WebLogic Web Services: Advanced Programming
BEAWebLogic Server WebLogic Web Services: Advanced Programming Version 10.0 Revised: April 28, 2008 Contents 1. Introduction and Roadmap Document Scope and Audience.............................................
More informationTHREADS AND CONCURRENCY
THREADS AND CONCURRENCY Lecture 22 CS2110 Spring 2013 Graphs summary 2 Dijkstra: given a vertex v, finds shortest path from v to x for each vertex x in the graph Key idea: maintain a 5-part invariant on
More informationJava Programming Constructs Java Programming 2 Lesson 1
Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.
More informationCS193k, Stanford Handout #8. Threads 3
CS193k, Stanford Handout #8 Spring, 2000-01 Nick Parlante Threads 3 t.join() Wait for finish We block until the receiver thread exits its run(). Use this to wait for another thread to finish. The current
More informationChapter 4: Processes. Process Concept. Process State
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating
More informationLecture Notes on Programming Languages
Lecture Notes on Programming Languages 85 Lecture 09: Support for Object-Oriented Programming This lecture discusses how programming languages support object-oriented programming. Topics to be covered
More informationThe Network. Multithreading. This tutorial can be found on -
This tutorial can be found on - http://www.informit.com/articles/article.aspx?p=25462&seqnum=5 Instant messaging is sweeping the world, and is rapidly replacing email as the preferred electronic communications
More informationOperating Systems (234123) Spring (Homework 3 Wet) Homework 3 Wet
Due date: Monday, 4/06/2012 12:30 noon Teaching assistants in charge: Operating Systems (234123) Spring-2012 Homework 3 Wet Anastasia Braginsky All emails regarding this assignment should be sent only
More informationDeveloping Microsoft.NET Applications for Windows (Visual Basic.NET)
Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Course Number: 2555 Length: 1 Day(s) Certification Exam This course will help you prepare for the following Microsoft Certified Professional
More informationInterprocess Communication
Interprocess Communication Reading: Silberschatz chapter 4 Additional Reading: Stallings chapter 6 EEL 358 1 Outline Introduction Shared memory systems POSIX shared memory Message passing systems Direct
More informationSoftware Paradigms (Lesson 10) Selected Topics in Software Architecture
Software Paradigms (Lesson 10) Selected Topics in Software Architecture Table of Contents 1 World-Wide-Web... 2 1.1 Basic Architectural Solution... 2 1.2 Designing WWW Applications... 7 2 CORBA... 11 2.1
More informationCS 351 Design of Large Programs Threads and Concurrency
CS 351 Design of Large Programs Threads and Concurrency Brooke Chenoweth University of New Mexico Spring 2018 Concurrency in Java Java has basic concurrency support built into the language. Also has high-level
More informationMultiple processes can run in parallel on a single computer and multiple threads can run in parallel in a single process.
EE 356 Notes on Threading A process is a program in execution. In an operating system a process has a well-defined state. A five-state model of a process includes: New a process is admitted for high-level
More informationItem 18: Implement the Standard Dispose Pattern
Item 18: Implement the Standard Dispose Pattern 1 Item 18: Implement the Standard Dispose Pattern We ve discussed the importance of disposing of objects that hold unmanaged resources. Now it s time to
More informationPart V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection
Part V Process Management Sadeghi, Cubaleska RUB 2008-09 Course Operating System Security Memory Management and Protection Roadmap of Chapter 5 Notion of Process and Thread Data Structures Used to Manage
More informationIBD Intergiciels et Bases de Données
IBD Intergiciels et Bases de Données RMI-based distributed systems Fabien Gaud, Fabien.Gaud@inrialpes.fr Overview of lectures and practical work Lectures Introduction to distributed systems and middleware
More informationSupporting Class / C++ Lecture Notes
Goal Supporting Class / C++ Lecture Notes You started with an understanding of how to write Java programs. This course is about explaining the path from Java to executing programs. We proceeded in a mostly
More informationAsynchronous Method Calls White Paper VERSION Copyright 2014 Jade Software Corporation Limited. All rights reserved.
VERSION 7.0.10 Copyright 2014 Jade Software Corporation Limited. All rights reserved. Jade Software Corporation Limited cannot accept any financial or other responsibilities that may be the result of your
More informationLesson I2C. I²C (Inter-Integrated Circuit) Lab Assignment: I2C Slave Driver
Lesson I2C I²C (Inter-Integrated Circuit) Lab Assignment: I2C Slave Driver I²C (Inter-Integrated Circuit) What is I 2 C I2C is pronounced "eye-squared see". It is also known as "TWI" because of the initial
More informationDeveloping Web Applications Using Microsoft Visual Studio 2008 SP1
Developing Web s Using Microsoft Visual Studio 2008 SP1 Introduction This five day instructor led course provides knowledge and skills on developing Web applications by using Microsoft Visual Studio 2008
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationChapter 13 Working with Threads
Chapter 13 Working with Threads Until relatively recently only advanced programmers understood and knew how to employ threads in application programs. Part of the problem was that using threads was not
More informationOperating System Support
Operating System Support Dr. Xiaobo Zhou Adopted from Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, Addison-Wesley 2005 1 Learning Objectives Know what a modern
More information05. SINGLETON PATTERN. One of a Kind Objects
BIM492 DESIGN PATTERNS 05. SINGLETON PATTERN One of a Kind Objects Developer: What use is that? Guru: There are many objects we only need one of: thread pools, caches, dialog boxes, objects that handle
More informationUnit 20: Extensions in ActiveBPEL
Unit 20: Extensions in ActiveBPEL BPEL Fundamentals This is Unit #20 of the BPEL Fundamentals course. In past Units we ve looked at ActiveBPEL Designer, Workspaces and Projects, created the Process itself
More informationObjectives. Introduce static keyword examine syntax describe common uses
Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method
More informationThreads are lightweight processes responsible for multitasking within a single application.
Threads Threads are lightweight processes responsible for multitasking within a single application. The class Thread represents an object-oriented wrapper around a given path of execution. The class Thread
More informationActor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd
Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd 1. Introduction Writing correct concurrent programs using shared data and locks is
More information5.4. Events and notifications
5.4. Events and notifications Distributed event-based systems extend local event model Allowing multiple objects at diff. locations to be notified of events taking place at an object Two characteristics:
More informationCS333 Intro to Operating Systems. Jonathan Walpole
CS333 Intro to Operating Systems Jonathan Walpole Threads & Concurrency 2 Threads Processes have the following components: - an address space - a collection of operating system state - a CPU context or
More informationVuGen.NET Protocol Recording Best Practices and Troubleshooting
Technical white paper VuGen.NET Protocol Recording Best Practices and Troubleshooting HP LoadRunner Best Practices Series Table of contents Introduction to.net Protocol Recording... 2 Importance of.net
More informationCS514: Intermediate Course in Computer Systems
: Intermediate Course in Computer Systems Lecture 23: March 12, 2003 Challenges of Mobility Mobility is a huge topic Breaks existing applications Anything bandwidth intensive or synchronous Opportunities
More informationCOSC 2P95 Lab 9 Signals, Mutexes, and Threads
COSC 2P95 Lab 9 Signals, Mutexes, and Threads Sometimes, we can't achieve what we want via a single execution pipeline. Whether it's for responsiveness, or to process more data simultaneously, we rely
More informationCourse Syllabus: In-Depth unipaas Programming Techniques
Course Syllabus: In-Depth unipaas Programming Techniques TABLE OF CONTENTS: 1 COURSE OBJECTIVES AND GOALS...2 2 GENERAL COURSE DETAILS...2 3 DETAILED LESSONS OUTLINE...3 3.1 WORKING WITH MEMORY... 3 3.2
More information7. System Design: Addressing Design Goals
7. System Design: Addressing Design Goals Outline! Overview! UML Component Diagram and Deployment Diagram! Hardware Software Mapping! Data Management! Global Resource Handling and Access Control! Software
More informationSoftware Architecture Patterns
Software Architecture Patterns *based on a tutorial of Michael Stal Harald Gall University of Zurich http://seal.ifi.uzh.ch/ase www.infosys.tuwien.ac.at Overview Goal Basic architectural understanding
More informationPace University. Web Service Workshop Lab Manual
Pace University Web Service Workshop Lab Manual Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University July 12, 2005 Table of Contents 1 1 Lab objectives... 1 2 Lab design...
More informationTHREADS & CONCURRENCY
4/26/16 Announcements BRING YOUR CORNELL ID TO THE PRELIM. 2 You need it to get in THREADS & CONCURRENCY Prelim 2 is next Tonight BRING YOUR CORNELL ID! A7 is due Thursday. Our Heap.java: on Piazza (A7
More informationDecisions: Logic Java Programming 2 Lesson 7
Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use
More informationCE221 Programming in C++ Part 1 Introduction
CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab
More informationDeveloping Microsoft.NET Applications for Windows (Visual Basic.NET)
Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Course Number: 2565 Length: 5 Day(s) Certification Exam This course will help you prepare for the following Microsoft Certified Professional
More informationAsynchronous Programming Demystified
Asynchronous Programming Demystified http://submain.com/webcasts/asynchronous-programming-demystified/ for the webcast recording, slides and demo code download 1/14/2015 Webcast Housekeeping Audio Connect
More information/* Copyright 2012 Robert C. Ilardi
/ Copyright 2012 Robert C. Ilardi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
More informationIntroduction. In this preliminary chapter, we introduce a couple of topics we ll be using DEVELOPING CLASSES
Introduction In this preliminary chapter, we introduce a couple of topics we ll be using throughout the book. First, we discuss how to use classes and object-oriented programming (OOP) to aid in the development
More informationContents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A
Contents Java RMI G53ACC Chris Greenhalgh Java RMI overview A Java RMI example Overview Walk-through Implementation notes Argument passing File requirements RPC issues and RMI Other problems with RMI 1
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More informationCS510 Operating System Foundations. Jonathan Walpole
CS510 Operating System Foundations Jonathan Walpole Threads & Concurrency 2 Why Use Threads? Utilize multiple CPU s concurrently Low cost communication via shared memory Overlap computation and blocking
More informationChair of Software Engineering. Java and C# in depth. Carlo A. Furia, Marco Piccioni, Bertrand Meyer. Java: concurrency
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: concurrency Outline Java threads thread implementation sleep, interrupt, and join threads that return values Thread synchronization
More informationElectronic Payment Systems (1) E-cash
Electronic Payment Systems (1) Payment systems based on direct payment between customer and merchant. a) Paying in cash. b) Using a check. c) Using a credit card. Lecture 24, page 1 E-cash The principle
More informationConcurrency Abstractions in C#
Concurrency Abstractions in C# 1 1 Motivation Concurrency in C# Concurrency critical factor in behavior/performance affects semantics of all other constructs advantages of language vs. library Compiler
More informationThe Microsoft.NET Framework
Microsoft Visual Studio 2005/2008 and the.net Framework The Microsoft.NET Framework The Common Language Runtime Common Language Specification Programming Languages C#, Visual Basic, C++, lots of others
More informationChapter Outline. Chapter 2 Distributed Information Systems Architecture. Layers of an information system. Design strategies.
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 2 Distributed Information Systems Architecture Chapter Outline
More informationChapter Outline. Chapter 2 Distributed Information Systems Architecture. Distributed transactions (quick refresh) Layers of an information system
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 2 Distributed Information Systems Architecture Chapter Outline
More informationDistributed Systems Project 4 Assigned: Friday March 20 Due: Friday April 3, 11:59pm
95-702 Distributed Systems Project 4 Assigned: Friday March 20 Due: Friday April 3, 11:59pm Project Topics: Java RMI and a distributed, Mobile to Cloud application This project has 2 tasks. Task 1 is a
More informationDistributed Collaboration - Assignment 1: Multi-View 1-User IM
Distributed Collaboration - Assignment 1: Multi-View 1-User IM Date Assigned:??? 1-View Target Date:??? Multi-View Submission Date:??? Objectives: Understand the use of observer pattern in user -interface
More informationYou can call the project anything you like I will be calling this one project slide show.
C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationVirtual Machine Design
Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview
More informationMCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com
70-483 MCSA Universal Windows Platform A Success Guide to Prepare- Programming in C# edusum.com Table of Contents Introduction to 70-483 Exam on Programming in C#... 2 Microsoft 70-483 Certification Details:...
More informationPart Two - Process Management. Chapter 3: Processes
Part Two - Process Management Chapter 3: Processes Chapter 3: Processes 3.1 Process Concept 3.2 Process Scheduling 3.3 Operations on Processes 3.4 Interprocess Communication 3.5 Examples of IPC Systems
More informationTHREADS & CONCURRENCY
27/04/2018 Sorry for the delay in getting slides for today 2 Another reason for the delay: Yesterday: 63 posts on the course Piazza yesterday. A7: If you received 100 for correctness (perhaps minus a late
More informationReplication. Consistency models. Replica placement Distribution protocols
Replication Motivation Consistency models Data/Client-centric consistency models Replica placement Distribution protocols Invalidate versus updates Push versus Pull Cooperation between replicas Client-centric
More informationBasic Properties of Styles
Component-Based Software Engineering ECE493-Topic 5 Winter 2007 Lecture 18 Enterprise Styles/Patterns (Part A) Ladan Tahvildari Assistant Professor Dept. of Elect. & Comp. Eng. University of Waterloo Basic
More informationConfiguring, Managing and Troubleshooting Microsoft Exchange Server 2010
Configuring, Managing and Troubleshooting Microsoft Exchange Server 2010 Course 10135B 5 Days Instructor-led, Hands-on Course Description This course will provide you with the knowledge and skills to configure
More informationFlag Quiz Application
T U T O R I A L 17 Objectives In this tutorial, you will learn to: Create and initialize arrays. Store information in an array. Refer to individual elements of an array. Sort arrays. Use ComboBoxes to
More informationMigrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#)
Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#) Course Length: 5 Days Course Overview This instructor-led course teaches developers to gain in-depth guidance on
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More informationNotes based on prof. Morris's lecture on scheduling (6.824, fall'02).
Scheduling Required reading: Eliminating receive livelock Notes based on prof. Morris's lecture on scheduling (6.824, fall'02). Overview What is scheduling? The OS policies and mechanisms to allocates
More informationXML Web Services Basics
MSDN Home XML Web Services Basics Page Options Roger Wolter Microsoft Corporation December 2001 Summary: An overview of the value of XML Web services for developers, with introductions to SOAP, WSDL, and
More informationTHE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II)
THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II) The exam will contain: 6 questions (3 for each part) Time
More informationC++ for Python Programmers
C++ for Python Programmers Adapted from a document by Rich Enbody & Bill Punch of Michigan State University Purpose of this document This document is a brief introduction to C++ for Python programmers
More informationTutorial 8 Build resilient, responsive and scalable web applications with SocketPro
Tutorial 8 Build resilient, responsive and scalable web applications with SocketPro Contents: Introduction SocketPro ways for resilient, responsive and scalable web applications Vertical scalability o
More informationIntegration Best Practices: Net Change Design Patterns
Integration Best Practices: Net Change Design Patterns HERE TODAY AND HERE TOMORROW, TOO: THE CHALLENGE OF CAPTURING CHANGED DATA BETWEEN APPLICATIONS. JANUARY 2008 WRITTEN BY: PETER R. CHASE - EXECUTIVE
More informationRefactoring Without Ropes
Refactoring Without Ropes Roger Orr OR/2 Limited The term 'refactoring' has become popular in recent years; but how do we do it safely in actual practice? Refactoring... Improving the design of existing
More information