1 / 8

Tutorials 2

Tutorials 2. A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design

Télécharger la présentation

Tutorials 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tutorials 2 • A programmer can use two approaches when designing a distributed application. Describe what are they? • Communication-Oriented Design Begin with the communication protocol. Design a message format and syntax. Design the client and server components by specifying how each reacts to incoming message and how each generates outgoing messages. • Application-Oriented Design Begin with the application. Design a conventional application program to solve the problem. Build and test a working version of the conventional program that operates on a single machine. Divide the program into two or more pieces, and add communication protocols that allow each piece to execute on a separate computer.

  2. Tutorials 2 • In many layered protocols, each layer has its own header. Surely it would be more efficient to have a single header at the front of each message with all the control in it than all these separate headers. Why is this not done? • Each layer must be independent of the other ones. The data passed from layer k + 1 down to layer k contains both header and data, but layer k cannot tell which is which. Having a single big header that all the layers could read and write would destroy this transparency and make changes in the protocol of one layer visible to other layers. This is undesirable.

  3. Tutorials 2 • Why are transport-level communication services often inappropriate for building distributed application? Doing this would shift the responsibility of the following onto the application developer: • The encoding of complex data structures into byte streams.  • Mapping of different data encoding due to the use of different hardware and programming languages.  • Dealing with object references in terms of domain names and port numbers.  • Implementing component activation, to start up dormant objects.  • Handling type safety checks which is tedious and error prone.  • Implementing synchronization between the client and the server, for invoking a request and receiving the results of it. 

  4. Tutorials 2 • What is the so called Remote Procedure Call? List all the steps occurs during a RPC. When a process on machine A calls a procedure on machine B, the calling process on A is suspended, and execution of the called procedure takes place on B. Information can be transported from the caller to the callee in the parameters and can comeback in the procedure result. No message passing at all is visible to the programmer. This method is known as Remote Procedure Call. A remote procedure call occurs in the following steps: Client procedure calls client stub in normal way Client stub builds message, calls local OS Client's OS sends message to remote OS Remote OS gives message to server stub Server stub unpacks parameters, calls server Server does work, returns result to the stub Server stub packs it in message, calls local OS Server's OS sends message to client's OS Client's OS gives message to client stub Stub unpacks result, returns to client

  5. Tutorials 2 • How can we pass the reference parameters in a RPC? Use the call by copy/restore way to tackle this problem. • Instead of letting a server register itself with a daemon as is done in DCE, we could also choose to always assign it the same endpoint. The endpoint can then he used in references to objects in the server’s address space. What is the main drawback of this scheme? • The main drawback is that it becomes much harder to dynamically allocate objects to servers. In addition, many endpoints need to be fixed, instead of just one (i.e., the one for the daemon). For machines possibly having a large number of servers, static assignment of endpoints is not a good idea.

  6. Can you describe the steps to use DCE RPC to write a distributed application?

  7. Tutorials 2 • Java and other languages support exceptions, which are raised when an error occurs. How would you implement exceptions in RPCs and RMIs? • Exceptions are data structures for details about failures. An exception is raised by a server object or by the distribution middleware. Exceptions are transferred via the network form the server or middleware to the client. When a client checks for the occurrence of an exception we say that the client catches the exception. When an exception occurs, the client can use the exception’s data structures in order to find out what went wrong. • Would it be useful to also make a distinction between static and dynamic RPCs? • Refer to (Tanenbaum 2002, page82 -83). It tells how to write a client and a server in RPC. From it we know that client and server are created in the static way.

  8. Tutorials 2 • Tell what are the compile-time and runtime objects in RMI? What are the transient object and persistent object? • Objects in distributed systems appear in many forms. One form is directly related to language-level objects such as those supported by Java, C++, or other object-oriented languages, which are referred to as compile-time objects. The alternative one is constructed during the runtime. In this case, we call it runtime object. • The persistent object is one that continues to exist even if it is currently not contained in the address space of a server process. In contrast, a transient object is an object that exists only as long as the server that manages the object.

More Related