 This is Supriya Ambarkar from Walton Institute of Technology, Solaapur. Today we are going to cover a topic on RPC, that is remote procedure calls such as its features, its model, implementation steps, server management, call semantics, etc. The learning outcome of this topic are at the end of this session, students will be able to state the implementation of RPC mechanism, students will be able to describe the difference between the stateful servers and stateless servers. First we will see the introduction of RPC. The RPC means remote procedure call, which is a protocol that one program can use to request a service from a program located in another computer on a network without having to understand the network's detail. So a procedure call is also known as a function call or a subroutine call. RPC uses the client server model, it is a special case of general message passing model of IPC. Then RPC has become a widely accepted IPC mechanism in distributed systems. Now we will see the features of RPC. It's having a simple call syntax, it's having a familiar semantics because its similarities are there in terms of the local procedure calls. Well-defined interfaces are there, it is easy for use. Generity is also important feature of RPC. Its efficiency is more than IPC mechanism it follows or it can be used for communication between processes on different machines as well as between different processes on the same machines. Now we will see the RPC model. This is a typical model of remote procedure call. Here the caller which is commonly known as client process. Which sends a call means a request message to the callee and callee is commonly known as a server process. And waits for a reply message. So the request message contains the remote procedures, parameters, among other things. The server process executes the procedure and then returns the result of procedure execution in a reply message to the client process. Once the reply message is received, the result of procedure execution is extracted and caller's execution is resumed. Here the server process is normally dormant, awaiting the arrival of the request message. When one arrives, the server process extracts the procedures, parameters, computes the result, sends a reply message and then avoids the next call message. Now we will see the one of the major issue of RPC. That is transparency. So the major issue in the designing of RPC is its transparency property. A transparent RPC mechanism is one in which local procedures and remote procedures are indistinguishable to programmers. Means here we want to hide the details. So there are the two types of transparencies. First, syntactic transparency and semantic transparency. In syntactic transparency, RPC should have exactly the same syntax as in local procedure calls. But in terms of semantic transparency, here the RPC are identical to those of the LPCs. Now we will see the implementing RPC mechanism. Here we want five elements. First is the client. Second, the client stub. Third, the RPC runtime. Fourth, the server stub. Fifth, the server. So to achieve the goal of semantic transparency, the implementation of RPC mechanism is based on the concept of stubs, which provide a perfectly normal means local procedure calls. Now here we will see the implementing RPC mechanism in detail. Here the client and server side are there. Then client is used for user process, which initiates a RPC call. To make RPC, the client makes a perfectly normal call and that invokes a corresponding procedure in the client stub. Then client stub is responsible for carrying out two tasks. Pack the target procedure and arguments and also unpack the result and passes it to the client. Then RPC runtime. It handles transmission of messages across the network between client and server machines. It is also responsible for retransmission, acknowledgement, packet routing, encryption, etc. Server stub. It also performs the two tasks, that is, unpacks the call request message from local RPC runtime and makes a perfectly normal call to invoke the appropriate procedure in the server. It also packs the result into message and send it to the client stub. Now the server part is there. Then server, it receives the call request from the server stub, then executes the appropriate procedure and returns the result to the server stub. So these are the implementation steps of the RPC mechanism. Now we will see the two types of RPC messages. RPC messages having the category call messages and reply messages. Under call message, it is sent by the client to the server for requesting execution of a particular remote procedure. Then reply message, it is sent by the server to the client for returning the result of remote procedure execution. Now we will see the marshaling arguments and the results. What is exactly meaning the concept of marshaling? The transfer of message data between two computers requires encoding and decoding of the message data. So RPCs, this operation is known as marshaling of the data. So a marshaling basically involves taking the arguments or results, encode that message data, and again it wants to decode the message data. So this is about the marshaling. Now we will see the server management concept. Server implementation having two types. Stateful server implementation, stateless servers. Server creation semantics are there. Instance per call servers, instance per session servers, persistent servers. Now we will see the details. First, stateful servers. A stateful server maintains client's state information from one RPC to the next. This client's state information is subsequently used at the time of executing the second call. Here in this diagram, which is an example of a stateful file server, let us consider a server for byte bit stream we want to transfer, which follows the few operations like open the particular file, read the operation and return. The client procedure is there and the server process is there. So server want to maintain the what is the file ID, what is the mode, what is the read write pointers are available and etc. The first client want to open a particular name of file with a mode, read or write. Then server will return the FID of that file. Again, first call will be made by the client that is and read that FID of 10 number of bytes with a particular buffer. Then server will give back the return number of bytes like a first 10 means 0 to 9. Then again client want to make the second call that is and read FID next 10 number of bytes and the buffer. Then second call will be performed and server will give the return in terms of bytes of next 10 means 10 to 90. So in such a way the stateful server is going to perform. Now we will see the stateless servers. Stateless server does not maintain any client state information. So every request should come up with all necessary parameters to successfully carry out the operation. So your client want to maintain everything, whatever the first call, whatever the second call, he want to send the particular information like file name, its position, n number of bytes and buffer. So server does not want to maintain anything. So this is all about stateless servers. Now we will see the server creation semantics. Server creation semantics are classified into instance per call servers, instance per session servers and persistent servers. So instance per call, server exists only for the duration of a single call. Instance per session, server exists for the entire session. And persistent server it maintains an existence indefinitely. Now pause the video and write down your answer why RPC communication package is used on both at client and server sites. To hide the existence and functional details of the underlying networks, an RPC communication package which is also known as RPC runtime is used on both the client and server sites. Now we will see the bit parameter passing semantics. There are two choices, either call by value or call by reference. In this method, all parameters are copied into message that is transferred from client machine to the server machine through the network. And what about call by reference? Most RPC mechanisms use the call by value semantics because client and server machine exist in the various different address spaces. So passing parameter by reference is meaningless. So here are the different types of call semantics which is available at the RPC mechanism, possibly or maybe call semantics, last one call semantics, last of many call semantics, at least once call semantics, exactly once call semantics. These are the few references which I have referred for this particular topic. Thank you one and all.