You are on page 1of 2

Synchronization Between Processes

Inter-Process Communication (commonly IPC) is a basic function of operating systems.


Processes can communicate with each other through shared memory spaces, either shared
variables or buffers, or through the tools provided by IPC routines. The IPC provides a
mechanism that allows processes to communicate and synchronize with each other, usually
through a low-level message passing system provided by the underlying network.
Communication is established following a series of rules (communication protocols). The
protocols developed for the Internet are the most widely used: IP (network layer),
transmission control protocol (transport layer) and file transfer protocol, hypertext transfer
protocol (application layer).The processes can be running on one or more computers
connected to a network. IPC techniques are divided into methods for: message passing,
synchronization, shared memory, and remote procedure calls (RPC). The IPC method used may
vary depending on the bandwidth and latency (the time since the request for information and
the beginning of the sending of the same) of the communication between processes, and the
type of data that is being communicated.

Communication services between processes are the basis of distributed systems by allowing
two processes to collaborate to achieve a task There are two basic mechanisms of
communication between processes 1- Communication between processes at the operating
system level (without network) They allow communication between two processes on the
same computer Examples: Message queues, semaphores, shared memory, etc. We are not
going to use them in this course 2- Communication between processes through a network
They allow communication between two processes that reside on the same network In this
case, communication occurs through the exchange of messages between a sender and a
receiver The Exchange can be one-to-one (unicast - unicast) or one-to-group (multicast -
multicast) Communication between processes.

When a computer has network support, it offers an API that provides communication services.
These APIs try to provide an abstract interface to the programmer. All APIs must provide at
least four types of operations to the developer. SEND: It is a primitive that invokes the process
sender for the purpose of transmitting data to a receiving process. This primitive must allow
identifying the receiving process as well as specifying the data to be transmitted. RECEIVE: It is
a primitive that invokes the receiving process in order to accept data from a sending process. It
must allow the receiver process to be identified as well as to specify the memory area in which
the received information will be stored. Initiation of the connection: For connection-oriented
communication mechanisms, there must be primites that allow the connection to be
established. Usually there are two of them: WAIT-CONNECTION: It is a primitive invoked by a
process that is willing to receive the connection from another process passively. INITIATE-
CONNECTION: This primitive is invoked by a process that wants to actively initiate a connection
with another process. It is necessary to identify the remote process DISCONNECT: In
connection-oriented communications, either end of an established connection can release it
by invoking this primitive Basic elements of an IPC API for networks.
Definition of Synchronize: "Make two or more phenomena coincide in time" How do we
synchronize the execution of SEND in one process with the execution of RECEIVE in the other?
The simplest synchronization mechanism is to use blocking commands.A blocking command is
one that blocks the process that invokes it until a certain condition is verified, at which point
the process is ready to send a message, the The first process that reaches the SEND / RECEIVE
command hangs until the other process “reaches it”. For the establishment of a connection,
the process that invokes WAIT is blocked until another process invokes START Synchronization
of remote processes.

IPC operations that block the calling process are called synchronous. A blocking operation is
only unlocked when the expected event occurs at the remote end. That is, we guarantee that
there is a synchronization There are many synchronous IPC APIs and it is possible to program
with them There are also asynchronous IPC APIs, in which calls are not blocked In these cases,
it is the responsibility of the programmer to achieve synchronization. Why can someone want
asynchronous calls? To avoid undefined locks To improve performance and not waste clock
cycles Example: program that receives from many sources and stores packets while (true) {int
result = receive (packet); if (result == -1) continue; else stores (package); } The programmer
must know whether to work with synchronous or asynchronous calls Synchronous Send and
Receive.

You might also like