What is a client-server system?

Operating SystemHardwareSoftware & Coding

Communication in client-server can communicate using shared memory and message passing.

These techniques can be used for communication in client-server systems.

Strategies for Communication

We can explore three other strategies for communication in client-server systems which are as follows −

Sockets

A socket is defined as an end point for communication. A pair of processes communicating over network employees or a pair of sockets, one for each process.

A socket is identified by an IP address connected with a port number. In general, sockets use client server architecture. The server waits for incoming client requests by listening to a specified port.

Once a request is received, the server accepts a connection from the client-server to complete the communication.

Example

When a client process initiates a request for a connection, it is assigned a port by its host computer. This port has some arbitrary number that is greater than 1024.

If a client on HOST S with IP address 126.48.5.30 wants to establish a connection with a web server at address 142.30.45.8, HOST S may be assigned port 1465.

The connection will consist of a pair of sockets: 126.48.5.30 : 1465 on HOST S and 142.30.45.8:80 on the web server.

Remote Procedure Call (RPC)

It is one of the most common forms of remote service in the RPC paradigm. The RPC was designed as a way to abstract the procedure call mechanism for use between systems with network connection.

It is similar in many aspects to the IPC mechanism and it is usually built on top of such a system. However, we are dealing with an environment in which the processes are executing on separate systems. We must use a message-based communication schema to provide remote service.

Pipes

A pipe acts as a connection which allows two processes to communicate. Pipes are one of the first IPC mechanisms in the early UNIX system. They typically provide one of the simpler ways for processes to communicate with one another, although they also have some limitations.

There are two types of pipes used on both UNIX and windows system −

  • Ordinary pipe

  • Named pipe

Ordinary pipe

Ordinary pipe allows two processes to communicate in standard procedure consumer fashion.

The producer writes to one pipe and the consumer reads from the other end. As a result ordinary pipes are unidirectional which is allowing one way communication. An ordinary pipe cannot be accessed from outside the process that creates it.

Typically a parent process creates a pipe and uses it to communicate with a child process which is created through fork().

Named pipes

Ordinary pipes provide a simple mechanism for allowing a pair of processes to communicate. However, ordinary pipes exist only while the processes are communicating with one another.

On both UNIX and Windows systems, once the processes are finished communicating and have terminated, the ordinary pipe ceases to exist.

Named pipes provide a powerful communication tool. Communication can be bidirectional and no parent child relationship is required. Once a named pipe is established several processes can use it for communication.

raja
Updated on 30-Nov-2021 10:41:22

Advertisements