1
7.5kviews
Discuss issues concerned with parameter passing in RPC.
1 Answer
2
346views

Issues concerned with parameter passing in RPC:-

  • The function of the client stub is to take its parameters, pack them into a message and send them to the server stub which can be a difficult process. The issues faced are as follows:

Passing Value Parameters-

  • Packing parameters into a message is called parameter marshaling. Consider a remote procedure, sum(i, j), which takes two integer parameters and returns their arithmetic sum.
  • The client stub takes its two parameters and puts them in a message and also puts the name or number of the procedure to be called in the message.
  • When the message arrives at the server, the stub examines the message to see which procedure is needed, and then makes the appropriate call.
  • When the server has finished execution, it takes the result provided by the server and packs it into a message. This message is sent back to the client stub, which unpacks it and returns the value to the client procedure
  • As long as the client and server machines are identical and all the parameters and results are scalar types, such as integers, characters, and Booleans, this model works fine.
  • But in a large distributed system, it is common that multiple machine types are present. Each machine often has its own representation for numbers, characters, and other data items.
  • Example, IBM mainframes use the EBCDIC character code, whereas IBM personal computers use ASCII. It is not possible to pass a character parameter from an IBM PC client to an IBM mainframe server using the simple scheme as explained above.
  • Similar problems can occur with the representation of integers and floating-point numbers.
  • Another problem exists because some machines number their bytes from right to left, whereas others number them left to right.

Passing Reference Parameters-

  • Some RPC mechanisms allow passing of parameters by reference in which pointers to the parameters are passed from client to server. Usually they are closed systems in which a single address is shared by many processes in a system.
  • For example distributed systems with distributed shared-memory mechanisms can allow passing of parameters by reference.
  • A pointer is meaningful only within the address space of the process in which it is being used.
  • Suppose there are two parameters to be passed, if the second parameter is the address of the buffer which is 1000 on the client, one cannot just pass the number 1000 to the server and expect it to work. Address 1000 on the server might be in the middle of the program text.
  • Another issue is the case of a pointer to an arbitrary data structure such as a complex graph. Some systems attempt to deal with this case by actually passing the pointer to the server stub and generating special code in the server procedure for using pointers.
  • A pointer is followed (dereferenced) by putting it in a register and indirecting through the register. When this special technique is used, a pointer is dereferenced by sending a message back to the client stub asking it to fetch and send the item being pointed to (reads) or store a value at the address pointed to (writes). While this method works, it is often highly inefficient.
Please log in to add an answer.