Communication in Client–Server Systems-Operating Systems-Unit-2-20A05402T

D Sumathi
13 Jun 202218:19

Summary

TLDRThis operating system class video script covers the fundamentals of client-server communication, focusing on three primary methods: circuit communication, remote procedure call (RPC), and pipes. It explains the client-server architecture, where clients request services and servers respond. The script delves into the concept of circuits as endpoints for communication, the use of well-known ports, and the process of establishing connections. It also introduces RPC as a powerful technique for client-server interaction, detailing the components involved in message passing and the process of marshalling and demarshalling. Lastly, it touches on pipes for inter-process communication in Unix systems, highlighting their unidirectional nature and the need for two pipes for two-way communication.

Takeaways

  • 🌐 The script discusses the communication in client-server systems, focusing on three main methods: circuit communication, RPC (Remote Procedure Call), and pipes.
  • 🔌 Circuit communication involves establishing a connection between a client and a server using IP addresses and port numbers, with well-known ports reserved for specific services like HTTP on port 80.
  • 📞 In RPC, a client can call a procedure on a server as if it were local, without worrying about the details of the remote interaction, which simplifies programming for distributed systems.
  • 📦 Marshalling in RPC is the process of packing the procedure call with its parameters into a message that can be sent over the network to the server.
  • 📬 Unmarshalling is the reverse process of marshalling, where the server unpacks the received message to extract the procedure call and its parameters.
  • 💻 The client and server systems are connected through a client stub, RPC protocol, server stub, and the server program, which work together to facilitate the remote procedure call.
  • 🔑 Well-known ports, ranging from 0 to 1023, are reserved for specific services, ensuring that communication is directed to the appropriate service on the server.
  • 🔄 Pipes provide a mechanism for inter-process communication (IPC) in Unix-like systems, allowing data to be passed from one process to another in a producer-consumer fashion.
  • 🔄 Ordinary pipes are unidirectional, meaning they allow communication in only one direction, typically from a producer process to a consumer process.
  • 🔄 For two-way communication, two separate pipes are required, each facilitating communication in one direction.
  • 📝 Pipes are limited to processes that have a common parent process, which restricts their use in certain IPC scenarios.
  • 📚 The script concludes with a question about marshalling and demarshalling in RPC, inviting students to answer in the comment box, indicating an interactive teaching approach.

Q & A

  • What is the basic concept of a client-server system?

    -A client-server system is a distributed application structure that partitions tasks or workloads between the providers of a resource or service, called servers, and service requesters, called clients. Clients are connected to the server through the internet, and the server provides services to the clients in response to their requests.

  • How does communication take place in a client-server system?

    -Communication in a client-server system occurs when the client sends a request to the server for a specific service. The server then processes the request and sends a response back to the client. This can be done through various methods such as circuit communication, RPC (Remote Procedure Call), and pipes.

  • What is a circuit in the context of client-server communication?

    -A circuit is an endpoint for communication between two processes, one in the client and the other in the server. It is established for the duration of their interaction and is defined by an IP address concatenated with a port number.

  • What are well-known port numbers and why are they reserved?

    -Well-known port numbers are a range of port numbers (0 to 1023) that are reserved for certain common services. For example, port 23 is reserved for Telnet, 21 for FTP, and 80 for HTTP. These ports are used to identify the service requested by the client.

  • Can you explain the concept of RPC (Remote Procedure Call)?

    -RPC 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 details. It allows a client to call a procedure on a server as if it were a local procedure call, abstracting the remote interaction details.

  • What is the role of a client stub in RPC communication?

    -A client stub in RPC communication is responsible for packing the message with the procedure parameters, which is then sent to the RPC protocol for transmission to the server. It also unpacks the server's response and provides the result to the client.

  • What is marshalling in the context of RPC?

    -Marshalling in RPC is the process of converting the data into a format that can be transmitted over the network. The client stub performs marshalling by packing the message with parameters before sending it to the server.

  • What is the purpose of the RPC protocol in client-server communication?

    -The RPC protocol is responsible for transferring the packed message from the client to the server and vice versa. It ensures that the message is delivered and received correctly between the client and server systems.

  • What is a pipe in client-server communication?

    -A pipe is a mechanism for inter-process communication (IPC) in Unix and Unix-like operating systems. It allows two processes to communicate with each other in a producer-consumer fashion, where one process writes to the pipe (producer) and another reads from it (consumer).

  • How does a pipe facilitate communication between processes?

    -A pipe allows for unidirectional communication between processes. The output of one process is written to the write end of the pipe, and another process reads from the read end of the pipe. This is useful for passing the output of one process as input to another.

  • What is the limitation of using pipes for inter-process communication?

    -The limitation of using pipes for IPC is that the processes using pipes must have a common parent process. This restricts the use of pipes to processes that are part of the same hierarchical process structure.

Outlines

00:00

🌐 Client-Server Communication Basics

This paragraph introduces the fundamental concepts of client-server communication in operating systems. It explains the simple architecture where multiple clients are connected to a server via the internet. The communication process involves clients sending requests to the server, which then responds with the requested service. The paragraph also touches on different types of communication, such as circuit communication and RPC (Remote Procedure Call). It further delves into the concept of a circuit as an endpoint for communication between client and server processes, identified by IP addresses and port numbers. The significance of well-known port numbers for services like FTP, Telnet, and HTTP is highlighted, along with the process of establishing a connection and exchanging packets between the client and server.

05:02

📞 Remote Procedure Call (RPC) Mechanism

The second paragraph focuses on RPC, a powerful technique for client-server communication that allows a client to execute a procedure on a server system as if it were local. The concept of local versus remote procedures is clarified, with examples provided to illustrate the difference. RPC is described as a message-passing system between client and server, involving five components: the client, client stub, RPC protocol, server stub, and server. The process of sending a message from the client to the server and back is detailed, including the steps of marshalling (packaging the message and parameters), the RPC protocol transferring the message, the server stub unpacking the message, the server processing the request, and the return value being sent back to the client through unmarshalling (unpackaging the return value).

10:03

🔄 Understanding Pipes for Inter-Process Communication

This paragraph explores the use of pipes in client-server communication, particularly in the context of Unix operating systems. Pipes allow for unidirectional communication between processes, with the example of a producer writing to one end of the pipe and a consumer reading from the other. The paragraph explains how pipes can be used to pass the output of one process as input to another, with the system temporarily holding this information until the receiving process is ready. The creation and use of file descriptors for accessing the read and write ends of the pipe are discussed, along with the concept of using two pipes for two-way communication. The limitation that processes using pipes must have a common parent process is also mentioned.

15:05

📝 Recap of Client-Server Communication Methods

The final paragraph serves as a recap of the three main methods of client-server communication covered in the script: socket communication, RPC, and pipes. It emphasizes the importance of understanding these methods for effective communication between clients and servers. The paragraph concludes with a question about marshalling and demarshalling in RPC, inviting students to answer in the comment box, and a teaser for the next class's topic.

Mindmap

Keywords

💡Client-Server System

A client-server system is a distributed system where services are provided by servers to clients over a network. In the context of the video, it is the fundamental architecture being discussed, where multiple clients connect to a central server via the internet to request and receive services. The script explains how clients issue requests to the server, which then responds with the appropriate service, illustrating the basic communication flow in such systems.

💡Circuit Communication

Circuit communication refers to a method of communication where a dedicated path, or 'circuit', is established between two processes, one on the client side and the other on the server side. The video script describes this as a way to facilitate communication between clients and servers, with the circuit being defined by an IP address and a port number, emphasizing the importance of unique circuits for each connection.

💡Remote Procedure Call (RPC)

RPC is a protocol that allows a program to cause a procedure to execute in a different address space, such as on a remote server, without the programmer having to write additional code for the remote interaction. The script explains RPC as a powerful technique for client-server communication, where the client can call a function on the server as if it were local, with the RPC protocol handling the message passing and communication details.

💡Well-known Port Numbers

Well-known port numbers are a range of port numbers (0 to 1023) reserved for specific services or applications. In the video, these port numbers are highlighted as being used for services like telnet (port 23), FTP (port 21), and HTTP (port 80). The script uses these as examples to explain how servers receive requests through these designated ports and how clients use them to establish connections.

💡Socket

In the context of network programming, a socket is an endpoint for communication between two processes. The script describes a socket as being defined by an IP address concatenated with a port number, which is crucial for establishing a connection in a client-server architecture. The concept is used to explain how communication is facilitated between clients and servers.

💡Marshalling

Marshalling is the process of packing data, such as procedure parameters, into a format that can be transmitted over a network. The script mentions this in the context of RPC, where the client stub packs the message with parameters before sending it to the RPC protocol for transmission to the server.

💡Demarshalling

Demarshalling is the reverse process of marshalling, where the packed data is unpacked at the receiving end. The video script describes demarshalling as the action performed by the server stub, which unpacks the received message and parameters before passing them to the server program for processing.

💡Pipes

Pipes are a form of inter-process communication used in operating systems, allowing data to be passed between processes in a producer-consumer fashion. The script explains ordinary pipes as unidirectional communication channels and discusses how they can be used for two-way communication by requiring two different pipes, one for each direction of communication.

💡File Descriptor

A file descriptor is an abstract representation of a file or other input/output resource in Unix and Unix-like operating systems. The script uses the term to explain how pipes are accessed through file descriptors, with one end of the pipe designated for reading (file descriptor 0) and the other for writing (file descriptor 1).

💡Two-way Communication

Two-way communication refers to the ability of two processes to exchange data in both directions. The script explains that while ordinary pipes allow for only one-way communication, two-way communication can be achieved by using two separate pipes, each dedicated to a single direction of data flow.

Highlights

Introduction to client-server communication in operating systems.

Simple architecture of client-server system explained with multiple clients connected to a server.

Clients request services from the server, which responds with the requested service.

Discussion on circuit communication and its role in client-server interaction.

Definition of a circuit as an endpoint for communication between client and server processes.

Explanation of socket communication, defined by IP address and port number.

Port numbers 0 to 1023 are reserved for well-known services like telnet, FTP, and HTTP.

Server receives client requests through specified ports, establishing a circuit connection.

Example given of host X connecting to a web server, illustrating socket communication.

Unique port numbers must be assigned for each connection to ensure uniqueness.

Introduction to remote procedure call (RPC) as a powerful technique for client-server communication.

RPC allows function calls to be made to procedures available on a different system.

Client-server interaction via RPC involves request and response message passing.

Five components involved in sending messages from client to server in RPC.

Explanation of marshalling and demarshalling in RPC, where messages are packed and unpacked.

Introduction to pipes for client-server communication, allowing processes to communicate in a producer-consumer fashion.

Ordinary pipes are unidirectional, requiring two pipes for two-way communication.

Pipes are used for passing information from one process to another, with a limitation that processes must have a common parent.

Summary of three types of client-server communication: socket communication, RPC, and pipes.

Transcripts

play00:00

hello friends welcome to today's

play00:02

operating system class and in this class

play00:03

we will see the communication in client

play00:06

server system

play00:07

and this is the very simple architecture

play00:09

of client server system here we are

play00:12

having more number of clients all the

play00:14

clients will be connected to the server

play00:16

through internet

play00:17

and all the services will be there in

play00:20

the server system first the client will

play00:23

give request to the server for any

play00:25

particular service

play00:29

requested to the server and the server

play00:33

will provide that particular service to

play00:36

the client in the form of response

play00:42

response okay so this is the very simple

play00:44

architecture how

play00:45

this communication will be taken place

play00:48

here we are going to see

play00:50

the circuit communication

play00:52

and rpc communication and pipe rpc is

play00:55

nothing but remote procedure call okay

play00:58

let us see all these things one by one

play01:01

the first one is communication using

play01:03

circuits

play01:06

first let us see what is circuit circuit

play01:08

is nothing but the end point for

play01:10

communication between two processes

play01:13

one process is in client and another

play01:15

process is in server okay this is the

play01:18

simple client server architecture for

play01:20

the socket communication here the socket

play01:23

is defined by ip address concatenated

play01:26

with the port number see

play01:28

up to this is ip address

play01:34

and this one is port number

play01:39

port number okay

play01:40

and when come to the server system this

play01:43

is ip address

play01:44

and this is port number

play01:48

when come to port number

play01:50

1024 port numbers are defined for some

play01:54

special purpose and those are called as

play01:56

well known port numbers

play01:58

that is 0 to

play02:00

1023 port numbers are reserved port

play02:03

numbers okay here 23 is reserved for

play02:06

telnet and 21 is reserved for ftp that

play02:10

is fine transfer protocol and 80 is

play02:13

reserved for web server or http

play02:17

okay

play02:19

so if we use any browser then

play02:22

we are using this

play02:24

id port number that is for web server

play02:27

okay here the server receives

play02:29

clients request

play02:31

this is the server system the server

play02:33

should receive the request from the

play02:35

client

play02:36

by specified port

play02:38

by specified port so normally the client

play02:41

can use browser

play02:44

browser hence

play02:46

http protocol is being used and port 80

play02:50

is reserved for this

play02:53

okay and

play02:55

once the request is received

play02:58

from the client

play02:59

then the server will accept that request

play03:03

and the connection from the client

play03:05

circuit will be established

play03:08

okay next the server implement the

play03:10

specific services

play03:13

through the through this particular

play03:15

circuit okay which may be either through

play03:18

telnet or through file transfer protocol

play03:21

or through

play03:22

the http hypertext transport protocol

play03:25

okay and

play03:26

listen to this well-known ports

play03:29

okay so the server will receive the

play03:32

request only through well-known ports

play03:35

only through well-known course that is

play03:38

normally the browser so client how to

play03:40

use the browser or ftp

play03:43

or telnet

play03:45

for establishing the connections and it

play03:48

will give this request to only through

play03:50

that connections okay that is the

play03:53

circuit connection

play03:54

let us see one example for this

play03:58

in this diagram we are having two

play04:00

systems first one is hostiac

play04:03

host x

play04:04

um the ip address for host x is

play04:06

146.86.5.20

play04:09

and this host x wanted to connect with

play04:12

the web server which ip address is this

play04:15

one that is 161.25.19.8

play04:20

okay and the port number for this host x

play04:24

is

play04:25

16.25 and for web server this is

play04:28

reserved for 80 because this is the web

play04:31

server this is the web server hence 80

play04:34

is reserved for this web server okay now

play04:37

the connection will consist of pair of

play04:40

circuits which are the pair of circuits

play04:43

this is the socket one and this is

play04:45

circuit that is client circuit and this

play04:47

is server circuit and from these two

play04:50

circuits connection will be established

play04:52

and the packets will be traveled between

play04:56

this connection

play04:58

okay the packets are traveling between

play05:01

host are delivered to appropriate

play05:04

process based on the destination port

play05:07

number

play05:08

okay so 1625 is assigned for host x the

play05:13

port number is assigned for host tx and

play05:16

80 is assigned for the web server here

play05:19

all the connections must be unique

play05:22

must be unique that is we have to assign

play05:26

a different port number for all the

play05:28

connections

play05:29

suppose if the host y which is wanted to

play05:32

connect with the server

play05:34

that is the web server then we have to

play05:37

assign different port number to this

play05:40

particular

play05:41

um

play05:43

host that is host y other than 0 to 1023

play05:49

okay so and we have we should not assign

play05:53

this

play05:53

uh

play05:55

1625 here again because all the port are

play05:59

unique

play06:02

and this ensures all connections consist

play06:05

of unique pair of circuits this is

play06:07

important

play06:11

the second one is remote procedure call

play06:14

which is another important and very

play06:16

powerful technique

play06:18

for communicating client and server

play06:20

systems

play06:22

okay and this is also known as function

play06:25

call our subroutine curve

play06:28

okay why it is called as function color

play06:30

subroutine curve for example this is our

play06:34

main program it may be void main

play06:38

okay in our main program we are having

play06:40

some function called

play06:43

student details

play06:48

student details that may be

play06:50

start here to here and some programs are

play06:53

also here

play06:55

see if we call this student detail

play06:59

in between this main program then this

play07:01

is the

play07:02

local procedure called not the remote

play07:04

procedural because the student detail

play07:06

function is available within the program

play07:10

itself within the system itself

play07:12

okay

play07:13

but

play07:15

when come to remote procedure call

play07:17

this function is available in some other

play07:20

system

play07:22

okay and we have tried to call that

play07:24

particular function from the client

play07:26

system

play07:27

okay so

play07:29

this is the

play07:30

function call that is the procedure call

play07:33

we we have to call this procedure p

play07:36

with the parameter xyz with the

play07:38

parameter xyz then the server system

play07:42

will receive this particular request and

play07:45

it will return the

play07:48

return value p to the client

play07:51

okay return to this procedure result

play07:54

that is the return value to this client

play07:58

okay

play07:59

here

play08:00

when a program causes a procedure to

play08:02

execute in different address space

play08:05

different address space means the

play08:06

procedure is available in the server

play08:09

system not in the client system okay but

play08:13

we have to code

play08:15

to call the procedure as a local

play08:18

procedure call without the details of

play08:21

remote interaction we simply call this

play08:23

particular procedure here the programmer

play08:26

how to write the same code whether the

play08:29

subroutine is local to this particular

play08:32

program to executing or the subroutine

play08:35

may be available in the remote program

play08:38

okay this is important

play08:41

okay so this form of client server

play08:43

interaction implemented via request and

play08:46

response message passing system

play08:49

okay here we are passing only the

play08:52

messages between the client and the

play08:55

server

play08:56

the server will receive the message in

play08:58

the form of procedure call and the

play09:00

client will receive the message in the

play09:02

form of result of this procedure

play09:06

here

play09:07

through this remote procedure called the

play09:09

client and server systems will be

play09:11

connected between each other okay so our

play09:14

pc protocol is available in the both end

play09:16

here this is the client system

play09:19

client system and this is server

play09:22

server system in this architecture five

play09:24

components are involved to sending

play09:27

message from

play09:29

the client to server

play09:31

client to server here

play09:33

we are having the first one is client

play09:36

this is the client okay client and

play09:38

clients tab claim staff is here and rpc

play09:42

protocol which is used to connect

play09:44

between the

play09:46

client and system and second next one is

play09:49

server step

play09:50

and the last one is server server is

play09:52

here okay so to sending the message from

play09:56

client to server to sending the message

play09:59

from client to server five components

play10:02

are involved

play10:04

[Music]

play10:06

and now let us see how the communication

play10:08

will be taken between the client system

play10:10

on the server system client system one

play10:13

server system

play10:14

as per this remote procedure call first

play10:17

the client sends the message to the

play10:20

client step say this is the client

play10:22

client send the message to client step

play10:25

and the client stop packs the message

play10:28

that is message with the parameters

play10:34

message with the parameter that is the

play10:36

function parameter or procedure

play10:38

parameters then this is called as

play10:40

marshalling and that will be sent to the

play10:43

remote procedure call so what is the

play10:45

duty of client step client stub will

play10:48

pack

play10:49

the message with the parameter okay and

play10:52

that packed message sends to the

play10:55

remote procedure called protocol rpc

play10:57

protocol and step 3 is the rpc protocol

play11:02

sends the packed message to rpc protocol

play11:05

of server see rpc protocol will transfer

play11:09

this message

play11:10

to the

play11:12

protocol of server system

play11:14

okay here and that will be given to

play11:18

servers tab

play11:20

the server step unpacks the message that

play11:23

is message

play11:27

plus parameter

play11:32

the server system the server step will

play11:35

unpack the message and parameter and

play11:38

that argument list will be given to the

play11:42

server program next the server processes

play11:45

the message via several functions are

play11:49

subroutines

play11:51

and sends back to the server step

play11:54

okay again the value will be written to

play11:56

the server step here the server step

play11:59

again packs the message that is the

play12:02

return value with the message

play12:04

okay

play12:08

plus message

play12:11

so this is called as smart selling again

play12:14

okay and that

play12:15

message backed message will be given to

play12:17

rpc protocol next day the server rpc

play12:21

protocol sends the

play12:22

packed message to the client rpc

play12:25

protocol now the connection will comes

play12:28

like this

play12:29

right and then the message is received

play12:32

by the clients tab

play12:34

client staff and the client stuff will

play12:37

deem or selling the message with the

play12:39

return value and this written value will

play12:41

be given to client system

play12:45

okay

play12:48

the third type of client server

play12:50

communication

play12:51

is by using pipes

play12:53

let us see first the ordinary pipes

play12:55

ordinary pipes allows two process can

play12:58

communicate

play13:00

to each other the standard formatter is

play13:03

producer and consumer fashion okay

play13:06

producer will stay in one end this is

play13:09

producer

play13:13

and this is consumer

play13:17

okay here the producer writes to one end

play13:20

of the pipe okay this is called as right

play13:23

end

play13:25

right end and the consumer reads from

play13:30

other end of this pipe so this end this

play13:33

is called as radiant

play13:37

radiant here

play13:38

the ordinary pipes are unidirectional

play13:41

okay only one way communication is

play13:43

possible in this ordinary pipes

play13:49

in unix operating system

play13:51

the pipe is a technique for passing

play13:53

information from one program's process

play13:56

to another process

play13:58

okay here the pipe is used to pass the

play14:01

parameters such as the output of one

play14:04

process to be

play14:05

the input of another process okay so

play14:09

this is process one this is p1 the

play14:12

output of p1

play14:14

this is the output will be given to

play14:17

input of

play14:18

another process for example p2

play14:22

okay

play14:23

so

play14:23

the system temporarily holds this piped

play14:26

information that is the temporary result

play14:29

a result of p1

play14:33

p1 result until it reads by the

play14:36

receiving process okay so

play14:39

the output will be weight until p2 is

play14:42

ready to read this particular output

play14:46

okay so for this we have to use this

play14:49

pipe to hold

play14:52

the

play14:53

temporary result or the output of p1

play14:59

so any pipe can access by using the read

play15:02

and write system calls

play15:04

here

play15:05

the pipe of

play15:07

int fd

play15:09

which is

play15:10

nothing but

play15:11

to create the pipe

play15:13

that accessed through

play15:15

this particular file descriptor

play15:19

okay fd is

play15:21

the file descriptor of type integer fd

play15:24

means file descriptor

play15:26

and

play15:27

fd of 0 that is file descriptor 0 ftf 0

play15:32

is read end of the pipe okay so this is

play15:36

radiant

play15:40

read end of the pipe and f1

play15:44

this is f1

play15:46

that is in the right end

play15:52

okay suppose if we want to read anything

play15:55

we have to use only this

play15:58

radian that is all fd of 0

play16:02

will access only in the read end and all

play16:06

fd of 1 will access only in the right

play16:09

end

play16:12

suppose if we want two-way communication

play16:15

the two-way communication required two

play16:17

pipes two different pipes okay

play16:20

so this is this pipe is for one

play16:22

direction this is right end

play16:26

and this is radiant

play16:30

radial this is parent process and child

play16:32

process okay suppose if we want to use

play16:35

this as

play16:36

read and this as right then we have to

play16:39

use another pipe

play16:41

okay pipe 2 should be used here we

play16:44

cannot read that is we cannot write in

play16:47

this end and we cannot read in this end

play16:50

because this is now right end

play16:54

we can write only this end and reading

play16:57

will be taken place only this particular

play16:59

end hence this is called as

play17:01

radiant

play17:03

so here it is

play17:04

right end and this is radiant

play17:06

when come to pipe two and this is right

play17:09

sorry radiant and this is right in okay

play17:12

so one pipe can use to form only one

play17:14

communication if you want two-way

play17:16

communication then we have to use two

play17:19

different pipes type one and pipe two

play17:23

and only one limitation in the pipe

play17:26

for this inter-processor's communication

play17:28

is that the process use pipes must have

play17:32

common parent process

play17:34

this is the only limitation in this

play17:37

pipe communication

play17:40

after this we have seen the

play17:42

communication in client server systems

play17:44

and there are three types first one is

play17:47

socket communication and second one is

play17:49

rpc that is remote procedure call and

play17:51

third one is pipes so by using these

play17:54

three methods the client server system

play17:56

will be communicated to each other now

play17:59

this is the question time

play18:00

and

play18:01

what is the marshalling and d marshaling

play18:07

in

play18:08

rpc

play18:09

okay students please write your answer

play18:11

in the comment box

play18:13

and the next class we will see another

play18:15

important topic from second unit thank

play18:17

you

Rate This

5.0 / 5 (0 votes)

Related Tags
Client-ServerCommunicationCircuitsRPCSocketsNetworkingTelnetFTPHTTPPipesOS Class