GEORGE MASON UNIVERSITY
COMPUTER SCIENCE DEPT

CS 571 Operating Systems

Assignment 4: Due Dec 8
Design and Implementation of Basic RPC Mechanisms

 

1. Overview

The goal of this assignment is to deepen your understanding of basic RPC mechanisms through the design and implementation of a RPC framework implemented on top of UDP.

 

Your RPC framework must include the standard RPC modules, i.e., communication module, client and server stubs, and dispatcher as discussed in the class and described in Chapters 4 & 5 of the book Distributed Systems: Concepts & Design by Coulouris et al (henceforth referred to as CDK3). However, you do not need to implement an IDL compiler – you have to hand-compile the stubs needed for the client and server programs that will use your RPC mechanism.

2. RPC Software Modules

 

The functionality of the various modules is discussed below.

 

Communication Module (CM)

The communication module implements the Request-Reply protocol that is at the heart of any RPC mechanism.  You have to implement procedures that are invoked by the client and server stubs. An API for the communication module (for RMI) was described in class (see class slides). This is a modification of the API described in Figure 4.12 of CDK3. You do not have to adhere to this API, but it should be helpful to you in your design.

 

Your RPC implementation should provide at most once semantics. Since your CM uses UDP as the transport protocol, this is the most challenging aspect of your assignment. The RRA protocol discussed in Chapter 4 of CDK3 can be used for your implementation. For this assignment, you can assume that the parameters and results of a remote procedure call will fit in one UDP datagram. Hence, you do not have to develop a complicated protocol that can handle multi-packet requests and replies.

 

For purposes of demonstrating your protocol at work, your CM must be programmed to drop request and reply messages. How you program this “feature” is up to you - you can either make this probabilistic, whereby the procedure that sends a UDP datagram randomly “drops” a packet or you can pass in a command-line argument to your client and server that triggers this lossy behavior.

 

Client and Server Stubs

The client and server stubs are responsible for marshalling and unmarshalling the parameters and results for a remote procedure call. You must implement marshalling and unmarshalling routines for the following data types:

  1. Integers
  2. Strings (a variable length character array)

 

Dispatcher

You have to implement a dispatcher that receives the request message from the communication module on the server side. The dispatcher is responsible for invoking the appropriate server-side stub, passing on the request. In your implementation, the dispatcher can be integrated into the communication module on the server side.

 

Server

You will need to write a server for each of the test programs described below. Your server program should include the procedures that are exported as remote procedures.  The server-side stubs, dispatcher, and communication module should be linked into your server executable. The server should listen on a hardcoded port for requests from clients.

 

Client

You will need to write a client for each of the test programs described below.  The hostname and port of the server should be supplied as command line arguments. Your client should invoke the client-side stubs when it wants to invoke a remote procedure call.      

3. Submission

 

You should submit

1.        A short document (5 – 10 pages) consisting of the following:

a.        A very short introduction outlining the content of your report.

b.       A description of the general architecture, with an illustration of how its components interact with each other to realize RPC.

c.        Key design decisions, including the fundamental data structures and algorithms for implementing the Request-Reply protocol and the marshalling/unmarshalling mechanisms.

d.       A description of how a client should invoke a client-side stub procedure, and how the procedure implementing a remote service should return its result to the server-side stub.

e.        Observations on your design, including a comparison with other possible designs.

       The document as a whole should make it clear how an invocation of the form 

x= rproc(arguments,….)

      can be compiled and can act as a RPC, where rproc is a remote procedure.

2.        A hardcopy of your code for this assignment.

3.        Any output that you have generated while testing your program that illustrates the correct functioning of your program. Note adding additional debug statements in your code may be useful for this purpose. Make sure that your output demonstrates the functioning of your Request-Reply protocol including the following cases:

a.        Lost Request messages

b.       Lost Reply messages

c.        Normal functioning (i.e. no lost messages)

4.        Send a softcopy of your code with instructions on how to compile and run the two test programs described below in an email to setia at cs.gmu.edu.

 

4. Test Programs

 

You should test your RPC software with the following programs:

 

  1. The arithmetic client-server program you developed for Assignment 4.
  2. A dictionary server.

1.        Original non-distributed program (with client and server functionality integrated): dict.c

2.        Progam with functionality corresponding to client: dict1.c

3.        Program with implementation of procedures: dict2.c

4.        SUN XDR interface file for remote version of dictionary server: rdict.x

5.        Example data for testing your program: data.txt

NOTE:

1.        You will have to modify dict1.c to convert it into your client. You should replace invocations of procedures initw(), insertw(), etc. into invocations of the corresponding stub procedures.

2.        You will have to link dict2.c into your server program. You can modify these procedures to work correctly along with your server-side stubs.

5.     Notes

 

1.        Please read Chapter 4 and 5 of CDK3 (especially sections 4.3, 4.4, 5.2 and 5.5) before starting this assignment.

2.         Please also look at the class slides on the project.

3.        You may find this program (UDPsock.c) useful for your assignment. The procedure IsAnythingThere() demonstrates the use of the select() system call for handling timeouts.

4.        Some of the socket tutorials available here have a more detailed discussion of the use of select(). Although most of this discussion is in the context of TCP sockets, it is also applicable to a datagram (UDP) socket.

 

 

.