0% found this document useful (0 votes)
57 views

Chapter2 Communication

This document discusses various concepts related to interprocess communication including synchronous and asynchronous communication, remote procedure calls, message passing, and message oriented vs stream oriented communication protocols like UDP and TCP. It provides an overview of process communication approaches like remote invocation, defining RPC and RMI, and explaining parameter passing techniques like call by value, reference, and copy/restore. It also outlines the basic steps involved in remote procedure calls.

Uploaded by

ERE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Chapter2 Communication

This document discusses various concepts related to interprocess communication including synchronous and asynchronous communication, remote procedure calls, message passing, and message oriented vs stream oriented communication protocols like UDP and TCP. It provides an overview of process communication approaches like remote invocation, defining RPC and RMI, and explaining parameter passing techniques like call by value, reference, and copy/restore. It also outlines the basic steps involved in remote procedure calls.

Uploaded by

ERE
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Contents

PROCESS.......................................................................................................................................................................... 1
INTERPROCESS COMMUNICATION..................................................................................................................................1
Synchronous and asynchronous communication............................................................................................................2
Remote invocation (middle layer)...................................................................................................................................2
RPC vs RMI...................................................................................................................................................................... 3
Call By Value:...................................................................................................................................................................3
Call by Reference:............................................................................................................................................................3
Call by Copy/Restore.......................................................................................................................................................3
RPC Steps:.......................................................................................................................................................................4
Message vs Stream oriented communication UDP vs TCP..............................................................................................4
Message passing:............................................................................................................................................................4
Message passing vs RPC..................................................................................................................................................5
MULTICAST...................................................................................................................................................................... 5

PROCESS
• Instance
• A concrete occurrence of any object in object- oriented programming (OOP);
• Existing during the runtime of a computer program.
• Formally, instance = object (with a particular value).
• Process
• The instance being executed by one or many threads;
• Contains the program code and its activity;
• May consist of many concurrently executing threads;
• Several processes may be associated with the same program.
• Multitasking
• Multiple processes to share processors (CPUs) and other system resources.
• Each CPU (core) executes a single task at a time.
• Each processor switches between tasks without waiting for finishing each task.
• Switches occur when
• Tasks perform input/output operations,
• Task indicates that it can be switched, or
• Hardware interrupts.
• Time-sharing
• A multitasking method to allow high responsiveness for interactive user applications.
• Context switches are performed rapidly
• Like multiple processes are being executed simultaneously on the same processor (concurrency).

INTERPROCESS COMMUNICATION
• Process communication
• Processes in an operation system
• Processes in different operation systems
• Exchanging messages across the computer network;
• The processes reside in the application layer.
• The Interface Between the Process and the Computer Network
Processes send and receive messages through a software interface called a socket;
Socket: Application Programming Interface (API) between the application and the
network
Characteristics:
• Endpoint for inter-process communication
• Message transmission between sockets
• A socket is associated with either UDP or TCP
• Sockets are bound to ports
• One process can use many ports
• Processes don’t share sockets (unless for IP multicast)
Socket= Internet address + port number
• Only one receiver but many senders per port
• Advantage: several points of entry to process
• Disadvantage: location dependence

The only control that the application developer has on the transport- layer side:
• The choice of transport protocol;
• A few transport-layer parameters such as maximum
buffer and maximum segment sizes
Addressing Processes:
• IP address
• Port number
Two message communication operations: send & receive (both can be blocking
or non-blocking). Receive is usually blocking– destination process blocked until
message arrives– most common case

Synchronous and asynchronous communication


Synchronous: blocking operations.

• Whenever a send is issued the sending process is blocked until the corresponding receive is issued.

• Whenever a receive is issued by a process, it blocks until a message arrives.

• Problems– failure and indefinite delay causes indefinite blocking (use timeout)– multicasting/broadcasting
not supported– implementation more complex

Asynchronous:

• Send is nonblocking

• Receive: Blocking or Non-blocking: the receiving process proceeds with its program after issuing a receive
operation.
• Problems– buffer overflow– error reporting (difficult to match error with message)

Remote invocation (middle layer)


1. Request-reply protocols:

• On top of message passing

• Two-way exchange of messages, as in client-server computing;

• Relatively low-level support for requesting the execution of a remote operation.

2. Remote procedure call (RPC)

• Client programs to call procedures transparently in server programs running in separate processes
and generally in different computers from the client.

3. Remote method invocation (RMI):

• Objects in different processes to communicate with one another;

• An object living in one process to invoke the methods of an object living in another process.

RPC vs RMI

Remote Procedure Call (RPC)

• A computer program causes a procedure to execute


in a different address space

• e.g., another computer on a shared


network.

Challenges:

• Different address spaces;

• Parameters and results also have to be


passed;

• Either or both machines can crash.

A stub is a piece of code that converts parameters passed


between client and server.
• Different address spaces;

• Different data representations.

Call By Value:
• Values of actual parameters are copied to function’s formal parameters;

• Two types of parameters are stored in different memory locations.

• Any changes made inside functions are not reflected in actual parameters of caller.

Call by Reference:
• Both the actual and formal parameters refer to same locations,

• Any changes made inside the function are actually reflected in actual parameters of caller.

Call by Copy/Restore
• A special case of call-by-reference

• The provided reference is unique to the caller.

• The final result on the referenced values will not be saved until the end of the function.

• The decision of which parameter passing mechanism to use is normally made by the language
designers and is a fixed property of the language.

• Sometimes it depends on the data type being passed.

RPC Steps:
• The client procedure calls the client stub in the normal way.

• The client stub builds a message and calls the local operating
system.

• The client's sends the message to the remote

• The remote gives the message to the server stub.

• The server stub unpacks the parameters and calls the server.

• The server does the work and returns the result to the stub.

• The server stub packs it in a message and calls its local.

• The server's sends the message to the client's.

• The client's gives the message to the client stub.

• The stub unpacks the result and returns to the client.


Message vs Stream oriented communication UDP vs TCP

Message-oriented communication

Message passing:
A technique for invoking behavior (i.e., running a program)
on a computer.

• The invoking program sends a message to a process (e.g.,


an actor or object) and relies on that process and its
supporting infrastructure to select and then run the code
it selects.

• A way for objects of a program to work with each other;

• A means for objects and systems in different computers to


interact.

Message Passing Interface

• A standardized and portable message-passing standard function on a wide variety of parallel


computing architectures.

• Consisting of syntax and semantics of


a core of library routines useful to a
wide range of users writing portable
message-passing programs in C, C++,
and Fortran.

• Supporting hybrid distributed


memory/shared memory systems.;

• Handling different interconnects and protocols.


Message passing vs RPC

MULTICAST
Question Bank

You might also like