Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
Published byModified over 4 years ago
Presentation on theme: "Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with."— Presentation transcript:
1 Tutorials 2A programmer can use two approaches when designing a distributed application. Describe what are they?Communication-Oriented DesignBegin 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 DesignBegin 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 2In 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 2Why 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 2What 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 wayClient stub builds message, calls local OSClient's OS sends message to remote OSRemote OS gives message to server stubServer stub unpacks parameters, calls serverServer does work, returns result to the stubServer stub packs it in message, calls local OSServer's OS sends message to client's OSClient's OS gives message to client stubStub 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 2Java 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 2Tell 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.