Remote Procedure Calls (RPC)

Neso Academy
9 May 201914:31

Summary

TLDRThis lecture delves into Remote Procedure Calls (RPC), contrasting it with Inter-Process Communication (IPC). RPC facilitates communication between processes on different systems over a network, abstracting network details from the processes. It operates on a message-passing system, where messages are well-structured and include function identifiers and parameters. The lecture explains the role of RPC daemons, parameter marshalling, and the use of stubs on both client and server sides to hide communication complexities. It sets the stage for the next lecture, which will address challenges faced by RPC and their solutions.

Takeaways

  • 🌐 **Remote Procedure Calls (RPC)**: RPC is a protocol that allows a program to request a service from another program located in a different computer or network without understanding the network's details.
  • 💬 **Communication Between Systems**: RPC is used when processes in different systems connected over a network need to communicate with each other.
  • 🔗 **Similarity to IPC**: RPC is similar to Inter-Process Communication (IPC) but is designed for processes executing on separate systems.
  • 📦 **Message-Based Communication**: Unlike shared memory in IPC, RPC uses a message-based communication scheme because processes are on different systems.
  • 📨 **Structured Messages**: Messages in RPC are well-structured and contain an identifier of the function to execute and parameters, unlike simple data packets in IPC.
  • 📡 **RPC Daemon**: Each RPC message is addressed to an RPC daemon listening on a port on the remote system, which is always waiting for incoming requests.
  • 🛠️ **Function as a Service**: In RPC, a function is considered a service that can be requested by one process from another, requiring the passing of parameters and potential return values.
  • 🔄 **Parameter Marshalling**: Parameters are packaged into a form that can be transmitted over a network, which is a critical step in the RPC process.
  • 🔄 **Message Passing**: The stub on the client side transmits a message to the server, which is received by a server-side stub to invoke the procedure.
  • 🔙 **Return Values**: After a function is executed on the server, any return values are passed back to the client using the same message passing technique.

Q & A

  • What is the main focus of the lecture?

    -The lecture focuses on remote procedure calls (RPC), which are used for communication between processes residing in different systems connected over a network.

  • How does RPC differ from local process communications?

    -RPC differs from local process communications by enabling communication between processes that are located on separate systems connected via a network.

  • What is the role of a network in the context of RPC?

    -In the context of RPC, the network connects different systems where processes reside and facilitates communication between them.

  • Why is message passing used in RPC instead of shared memory?

    -Shared memory is not feasible in RPC because processes are in different systems. Therefore, message passing is used as the communication scheme.

  • What is the purpose of an RPC daemon?

    -An RPC daemon is a program that always listens on a port on the remote system, waiting to receive incoming requests and execute the corresponding functions.

  • How are messages structured in RPC communications?

    -Messages in RPC communications are well-structured and contain an identifier of the function to execute and the parameters to pass to that function.

  • What is a stub in the context of RPC?

    -A stub in the context of RPC is a piece of code on the client side that hides the communication details from the client and facilitates the invocation of remote procedures.

  • What happens when a client invokes a remote procedure?

    -When a client invokes a remote procedure, the RPC system calls the appropriate stub, which then locates the server's port and marshals the parameters before sending the message.

  • What is parameter marshalling?

    -Parameter marshalling is the process of packaging parameters into a form that can be transmitted over a network for remote procedure calls.

  • How are return values from a remote procedure communicated back to the client?

    -Return values from a remote procedure are communicated back to the client using the same message passing technique that was used to send the initial request.

  • What issues might arise in RPC and how are they addressed?

    -Issues in RPC can include network latency, security concerns, and data serialization/deserialization problems. These issues are addressed in subsequent lectures.

Outlines

00:00

🔌 Introduction to Remote Procedure Calls (RPC)

This paragraph introduces the concept of Remote Procedure Calls (RPC) as a method for processes residing on different systems connected over a network to communicate. It contrasts RPC with Inter-Process Communication (IPC), which is typically local. The paragraph explains that RPC abstracts the network details, allowing programs to request services from other programs on the network without understanding the underlying network protocols. It also highlights the shift from shared memory systems used in IPC to message passing systems necessary for RPC due to the distributed nature of the systems involved.

05:00

📡 Understanding RPC Communication and Daemons

The second paragraph delves into how RPC communication is structured and the role of RPC daemons. It describes an RPC daemon as a program that constantly listens on a port for incoming requests. The paragraph explains that messages in RPC are well-structured and contain an identifier for the function to be executed and the parameters for that function. It also discusses the concept of 'function' in programming and how RPC mirrors this by allowing a process to request a service (function) from another system, with the results being returned to the requesting process.

10:00

🛠 The Role of Stubs and Parameter Marshalling in RPC

The final paragraph focuses on the technical aspects of RPC, particularly the function of stubs and parameter marshalling. It explains that stubs on the client side are used to abstract the communication details from the client process. When a remote procedure is invoked, the appropriate stub locates the server's port and marshals the parameters, packaging them in a form suitable for network transmission. The paragraph also describes the server-side stub, which receives the message, invokes the procedure with the provided parameters, and handles the return of any results back to the client using message passing techniques.

Mindmap

Keywords

💡Remote Procedure Calls (RPC)

Remote Procedure Calls (RPC) is a protocol that allows a program to request a service from a program located in another computer or network without the need to understand the network's details. In the context of the video, RPC is the main theme, explaining how processes residing in different systems can communicate with each other. RPC is used to execute a procedure on a remote system, as if it were local, by hiding the communication details from the client process.

💡Inter-Process Communication (IPC)

Inter-Process Communication (IPC) refers to the mechanisms that allow different processes to communicate with each other. The video script discusses IPC in contrast to RPC, highlighting that IPC typically involves processes on the same system using shared memory or message passing, whereas RPC is used for processes on different systems connected over a network.

💡Message Passing

Message Passing is a communication scheme where processes communicate by sending messages to each other. The script explains that unlike shared memory systems, where processes can directly read/write to a shared memory space, RPC uses message passing because it involves processes on different systems. In RPC, messages are well-structured and contain an identifier of the function to execute and the parameters to pass.

💡Shared Memory

Shared Memory is a type of IPC mechanism where processes communicate by reading from or writing to a shared memory space. The video script contrasts shared memory with message passing, stating that in RPC, since processes are on different systems, shared memory is not feasible, and thus message passing is used instead.

💡Network

A network in this context refers to a system of interconnected computers or devices that can exchange data. The video script emphasizes that RPC is necessary when processes on different systems, connected via a network, need to communicate. The network facilitates the communication between these remote processes.

💡RPC Daemon

An RPC Daemon is a program that is always running and listening for incoming requests on a specific port on the remote system. The script describes how each RPC message is addressed to an RPC daemon, which then handles the execution of the requested service or function. This is a critical component of the RPC mechanism as it receives and processes the remote procedure calls.

💡Parameters

Parameters are the inputs or arguments that are passed to a function or procedure. In the video script, parameters are mentioned in the context of RPC, where they are packaged and sent along with the function identifier in the message to the remote system. The parameters are essential for the execution of the remote procedure.

💡Marshalling

Marshalling in the context of RPC refers to the process of converting data into a format that can be transmitted over a network. The video script explains that the stub on the client side marshals the parameters before sending them to the server, ensuring that the data is in a form suitable for network transmission.

💡Stub

A Stub in RPC is a piece of code that acts as a client-side proxy for a remote procedure. The script describes how the client-side stub hides the communication details from the client, allowing it to invoke a remote procedure as if it were local. The stub locates the server port, marshals the parameters, and sends the message to the server.

💡Ports

Ports are numerical identifiers used in networking to route messages to the correct service or process on a server. The video script mentions that each service on the server is identified by a port number, and the client-side stub locates the appropriate port to send the RPC message. Ports are crucial for directing RPC requests to the correct service on the server.

Highlights

Remote Procedure Calls (RPC) enable communication between processes residing in different systems connected over a network.

RPC is a protocol that allows one program to request a service from another program located in another computer or network without understanding network details.

RPC uses a message-based communication scheme due to the processes executing on separate systems.

In RPC, messages exchanged are well-structured and contain an identifier of the function to execute and the parameters to pass.

RPC daemons listen to ports on remote systems to receive and process incoming requests.

RPC hides the communication details from the processes by providing a stub on the client side.

Each remote procedure has a corresponding stub that handles the communication on the client side.

When a client invokes a remote procedure, the RPC system calls the appropriate stub and passes the parameters.

The stub locates the server's port and marshals the parameters into a form that can be transmitted over the network.

Parameter marshaling is the process of packaging parameters into a form suitable for network transmission.

The server-side stub receives the message, invokes the procedure, and executes the function with the passed parameters.

After the remote procedure execution, return values are passed back to the client using the message passing system.

RPC semantics allow a client to invoke a procedure on a remote host as it would invoke a procedure locally.

RPC is similar to IPC but requires a message-based communication scheme due to the distributed nature of the processes.

The lecture will cover the issues faced by RPC and their resolutions in a subsequent session.

The next lecture will provide a comprehensive view of RPC after addressing the encountered issues.

Transcripts

play00:00

in this lecture we'll be studying about

play00:01

remote procedure calls in the previous

play00:04

lecture we have been studying about

play00:05

inter-process communications and we have

play00:08

seen how inter-process communications

play00:09

takes place using the shared memory

play00:12

systems and also using the message

play00:14

passing systems and we have also studied

play00:16

about sockets and we saw how sockets

play00:19

help in establishing communication

play00:21

between processes so till now the

play00:24

inter-process communications that we

play00:25

have studied about we're mostly based on

play00:28

local process communications that means

play00:31

we were seeing how processes that

play00:34

resides in a same system communicates

play00:37

with each other now remote procedure

play00:39

calls come into play when we want

play00:43

processes that are residing in different

play00:45

systems connected over a network wants

play00:49

to communicate with each other so think

play00:51

of a scenario where one process that is

play00:54

residing in a system wants to

play00:56

communicate to another process which is

play00:59

residing physically in another system

play01:01

and these two systems are connected via

play01:04

a network so in this kind of a scenario

play01:07

we need to use remote procedure calls

play01:10

and remote procedure calls will help us

play01:12

in communication between processes that

play01:15

are residing in different systems

play01:17

connected over a network so remote

play01:20

procedure call or RPC is a protocol that

play01:23

one program can use to request a service

play01:26

from a program located in another

play01:29

computer or a network without having to

play01:32

understand the network's

play01:33

details so RPC is a protocol that helps

play01:37

one program to request a service from

play01:40

another program located in another

play01:42

computer on a network and it does so in

play01:46

such a way that the processes that are

play01:48

communicating does not need to

play01:50

understand the network's details so the

play01:53

network's details does not have to be

play01:55

understood by the processes that are

play01:57

communicating so RPC takes care of this

play02:00

now this RPC is similar in many respect

play02:04

to the IPC mechanism so we have studied

play02:06

about IPC which stands for inter process

play02:09

communication so RPC is similar to

play02:13

I PC in many ways however because we are

play02:16

dealing with an environment in which the

play02:18

processes are executing on separate

play02:21

systems we must use a messaged base

play02:24

communication scheme to provide remote

play02:26

service so though our PC is similar to

play02:30

IPC in many ways the difference is that

play02:32

since in our PC we are dealing with an

play02:35

environment in which processes are

play02:37

executed on separate systems we need to

play02:40

use a messaged based communication

play02:42

scheme so if you remember about the two

play02:44

communication schemes that we have

play02:46

studied we have studied about shared

play02:48

memory system and we have studied about

play02:50

message passing system so in shared

play02:52

memory system what happens is when the

play02:55

processors wants to communicate with

play02:56

each other there is a region or shared

play02:59

memory that they have and the process

play03:02

that wants to communicate just writes

play03:04

whatever it wants to communicate on the

play03:06

shared region and the other process just

play03:08

reads from that shared region but in

play03:11

case of RPC we are dealing with

play03:13

processes that are residing in two

play03:15

different systems that are connected by

play03:17

our network so in this kind of a system

play03:20

it may not be possible to have a shared

play03:22

region of memory so that shared memory

play03:25

system may not be possible so we have to

play03:28

use the other kind of communication

play03:29

scheme that we have studied which is the

play03:31

message passing system so in our PC we

play03:34

will be using a message based

play03:36

communication scheme so moving on let us

play03:39

see what are the other differences that

play03:41

our PC has as compared to IPC so in

play03:45

contrast to the IPC facility the

play03:47

messages exchanged in RPC communications

play03:50

are well-structured and are thus no

play03:53

longer just packets of data so in case

play03:56

of IPC whenever we use the message

play03:58

passing systems those messages were just

play04:01

packets of data and nothing else so if

play04:03

you remember when we studied about

play04:04

message passing system the process that

play04:07

wants to send the message just sends

play04:09

that message as a packet to the kernel

play04:11

and from the kernel it goes to the

play04:13

process to which that message was

play04:15

intended to so messages were just

play04:18

packets of data but in case of RPC it is

play04:21

not just happening in a single system it

play04:23

has to travel between one system to the

play04:26

other

play04:27

so we cannot just keep our messages as

play04:29

simple packets of data but they have to

play04:32

be well structured because they have to

play04:34

travel over a network

play04:36

so each message is addressed to an RPC

play04:38

daemon listening to a port on the remote

play04:41

system and each contains an identifier

play04:45

of the function to execute and the

play04:47

parameters to pass to that function so

play04:50

in case of RPC whenever the message

play04:52

passing takes place that means whenever

play04:54

one process wants to communicate to

play04:56

another process residing in another

play04:57

system the message is sent in such a way

play05:00

that the message is addressed to a RPC

play05:03

daemon which is listening to a port on

play05:05

the remote system

play05:06

so by daemon we mean that a program

play05:09

which is always listening or which is

play05:11

always on and which is always listening

play05:13

and is waiting to get some input and

play05:15

based on that it will work so this RPC

play05:18

daemon is always listening to a port on

play05:21

the remote system waiting for some

play05:23

incoming requests so we have also

play05:25

studied about the concept of port in the

play05:27

lecture where we discuss about sockets

play05:29

so if you have not seen that I request

play05:31

you to kindly watch that lecture where

play05:33

we have discussed about ports and how

play05:35

ports are assigned to different

play05:37

processes so as we were saying in case

play05:39

of RPC when the message is sent it is

play05:42

addressed to the RPC daemon which is

play05:44

listening to the port on the remote

play05:45

system and each of the message that is

play05:48

send it contains an identifier of the

play05:50

function to execute and the parameters

play05:53

to pass to that function now we are

play05:55

using the term function here so what is

play05:57

a function so when we study programming

play05:59

we know what are functions so function

play06:01

is a piece of code that is written which

play06:03

performs a specific task so what are the

play06:06

requirements that we need in a function

play06:08

the function needs parameters so based

play06:10

on the parameters the operation is

play06:12

performed on that parameters and

play06:14

something is returned so in case of RPC

play06:17

think of this function as a service

play06:20

which is going to be requested by one

play06:23

process from the other process so there

play06:26

is a process deciding in a system and

play06:28

this process wants a service which is

play06:31

provided by another process residing in

play06:33

another system so think of that service

play06:36

as a function so what do we do we have

play06:39

to pass the pattern

play06:40

meters of the function and we have to

play06:42

call the function and then the function

play06:44

will be executed

play06:46

so in the same way in this RPC we have

play06:49

to pass the identifier of the function

play06:51

which may be like a function name and

play06:52

then the parameters that we have to pass

play06:55

to the function then after that what

play06:57

happens the function is then executed as

play06:59

requested and any output is sent back to

play07:02

the requester in a separate message so

play07:04

let's take the example of a simple

play07:06

function in programming again what

play07:08

happens when we call a function when we

play07:10

call a function we pass the parameters

play07:12

and when the function is called the

play07:14

function gets executed and after

play07:16

execution if there are anything to be

play07:18

returned that will be returned and where

play07:21

will it be returned it will be returned

play07:22

to the place where the function was

play07:24

called so in case of our RPC who is the

play07:27

one who called the function or the

play07:28

service it is the first process or the

play07:30

client so after the function is executed

play07:33

in the other system the things that has

play07:36

to be returned the return values has to

play07:38

be passed back to the client again and

play07:40

that will be done in a separate message

play07:43

using the message passing system so that

play07:45

is basically how the RPC functions so we

play07:49

have seen an overview of how the RPC

play07:51

functions now let us see how does the

play07:53

semantics of RPC allow a client to

play07:56

invoke a procedure on a remote host as

play07:59

it would invoke a procedure locally so

play08:01

we already know how processes

play08:03

communicate in a local set up that means

play08:05

when they are residing in the same

play08:07

system so in case of RPC when the

play08:09

processes are residing in two different

play08:12

systems connected over a network let us

play08:14

see how does the communication take

play08:16

place so the RPC system hides the

play08:19

details that allow communication to take

play08:21

place by providing a stub on the client

play08:24

side and typically a separate stub

play08:26

exists for each separate remote

play08:28

procedure so as I already told you RPC

play08:31

system it hides the details that allow

play08:34

communication to take place by providing

play08:36

a stub on the client side so when we use

play08:38

this RPC the process does not have to be

play08:41

concerned about how the communication

play08:42

takes place RPC hides the details of

play08:45

that and how does it do by providing a

play08:47

stub on the client side and we will see

play08:50

what is a function of this stub as we

play08:51

move ahead and typically a

play08:54

stub exists for each separate remote

play08:56

procedure so let us move ahead and see

play08:58

what is a function of this stub what

play09:00

does it do and how does it proceed so

play09:03

when a client invokes a remote procedure

play09:05

the RPC system calls the appropriate

play09:08

stub passing it the parameters provided

play09:12

to the remote procedure and this stub

play09:14

locates the port on the server and

play09:16

marshals the parameters so when a client

play09:19

invokes a remote procedure that means

play09:21

when a client a process in one system

play09:24

wants to get the service of the process

play09:26

residing in another system what does it

play09:28

do it invokes that procedure the client

play09:30

invokes the remote procedure we use the

play09:33

term remote because it is residing in

play09:35

another system not in the same system so

play09:37

when the procedure is invoke what

play09:39

happens the RPC system it calls the

play09:42

appropriate stub and then it passes the

play09:45

parameters provided to the remote

play09:47

procedure so whenever we say remote

play09:49

procedure think of it as a function a

play09:51

function that we have written in a

play09:53

program what does it do it executes

play09:55

something it provides a certain service

play09:57

so what is required in a function we

play10:00

have to pass a parameters to a function

play10:02

so when the client invokes a remote

play10:04

procedure the RPC will call the

play10:06

appropriate stub and it will pass the

play10:08

required parameters that are provided to

play10:10

the remote procedure and then this stub

play10:13

locates the port on the server and

play10:15

marshall's the parameters so the stuff

play10:18

will locate the port on the server so on

play10:21

the server there will be different kind

play10:23

of services that will be available and

play10:25

each service will be identified by a

play10:27

port number so we have discussed about

play10:29

port in the previous lecture where we

play10:31

studied about sockets so that specific

play10:34

port has to be found out so the stub

play10:36

will do that part it will locate the

play10:38

port on the server and it marshals the

play10:41

parameters that means it will combine

play10:43

the parameters in a specific way so let

play10:46

us now understand what is the meaning of

play10:47

this term marshall's and what is the

play10:50

meaning of the stub marshall's the

play10:52

parameters so parameter marshaling

play10:54

involves packaging the parameters into a

play10:57

form that can be transmitted over a

play11:00

network so we got all the parameters

play11:03

that were required for the function to

play11:04

execute and where is it function keep in

play11:06

mind it is in the server

play11:08

it is the remote procedure that we are

play11:10

going to invoke so we have all the

play11:13

parameters to be passed to that and

play11:15

parameter marshaling involves packaging

play11:18

the parameters into a form that can be

play11:20

transmitted over a network since the

play11:22

procedure is residing in another system

play11:24

this parameters has to be passed over

play11:26

the network to the other system so since

play11:29

it has to travel through the network the

play11:32

parameters have to be in a form that can

play11:34

be transmitted over a network

play11:36

so parameter marshalling means it will

play11:38

package the parameters into a form which

play11:41

can be transmitted over the network so

play11:44

that is what we mean by parameter

play11:45

marshaling the stub then transmits a

play11:48

message to the server using message

play11:49

passing so now everything is ready and

play11:52

after it is ready the stub will transmit

play11:54

the message to the server using message

play11:56

passing system so we have passed the

play11:59

message from the client side to the

play12:01

server so what happens on the server

play12:03

side

play12:03

a similar stub on the server side

play12:06

receives this message and invokes the

play12:09

procedure on the server so just like we

play12:11

had stub on the client side there is a

play12:13

stub also on the server side the stub on

play12:16

the server side will receive the message

play12:18

that we have sent and what was there in

play12:20

the messages the parameters were there

play12:22

for the function to be invoked so that

play12:25

function will be invoked using the

play12:27

parameters that was passed and the

play12:29

function will be executed alright so

play12:31

what will be the last step when we are

play12:33

executing a function in a program what

play12:35

is the last step after the function is

play12:37

executed the result has to be a return

play12:39

to the place where the function was

play12:41

called so if necessary return values are

play12:44

passed back to the client using the same

play12:46

technique so similarly in this RPC after

play12:50

the function is executed that means

play12:51

after the service has been executed if

play12:53

there are any return values it has to be

play12:56

passed back to the place from where the

play12:58

service was called and from where was it

play13:00

called it was called from the client

play13:02

side so those return values has to be

play13:04

passed back to the client and how is it

play13:06

passed back it is passed back by using

play13:09

the same message passing technique so

play13:12

this is how basically a remote procedure

play13:14

call works so we have seen that remote

play13:17

procedure call is something that is used

play13:19

when communication has to take place

play13:21

between processes

play13:22

that are residing in different systems

play13:24

connected over a network so this is the

play13:26

basic working of an RPC all right though

play13:29

we have seen the working of an RPC

play13:32

during this procedure during this entire

play13:34

process there are certain issues that we

play13:37

face and these issues has to be

play13:39

considered these issues has to be

play13:41

addressed and there has to be some way

play13:43

this issues have to be resolved so in

play13:46

the next lecture we will see what are

play13:48

the issues that are faced by an RPC and

play13:50

how are those issues resolved and after

play13:54

resolution of those issues we will see

play13:56

as a whole how RPC works we have already

play13:59

seen how RPC works in this lecture but

play14:01

we also have to see how are those issues

play14:04

tackled when they are encountered so we

play14:07

will see the entire working of an RPC

play14:09

after resolution of all those issues

play14:12

in the next lecture so with this I hope

play14:14

the basic concept of RPC was clear to

play14:17

you thank you for watching and see you

play14:19

in the next one

play14:20

[Applause]

play14:27

you

play14:31

[Music]

Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
Remote Procedure CallsInter-System CommunicationNetwork ProtocolsRPC MechanismMessage PassingParameter MarshalingIPC vs RPCDistributed SystemsNetwork CommunicationProgramming Concepts
هل تحتاج إلى تلخيص باللغة الإنجليزية؟