Process Part 3: Operating System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

PROCESS PART 3

O P E R AT I N G S Y S T E M
INDEPENDENT PROCESS VS
COOPERATING PROCESS
• A process is independent if it cannot affect or be affected by the other processes executing in the
system. Any process that does not share data with any other process is independent.
• A process is cooperating if it can affect or be affected by the other processes executing in the
system. Any process that shares data with other processes is a cooperating process.
• Operating system needs to provide an environment that allows process cooperation for:
– Information sharing. Since several users may be interested in the same piece of information (for instance, a
shared file), we must provide an environment to allow concurrent access to such information.
– Computation speedup. If we want a particular task to run faster, we must break it into subtasks, each of
which will be executing in parallel with the others.
– Modularity .We may want to construct the system in a modular fashion, dividing the system functions into
separate processes or threads
– Convenience. Even an individual user may work on many tasks at the same time. For instance, a user may
be editing, listening to music, and compiling in parallel.
INTERPROCESS COMMUNICATION
MECHANISM
• Cooperating processes require an interprocess communication (IPC) mechanism that will
allow them to exchange data and information.
• There are two fundamental models of interprocess communication: shared memory and
message passing.
MESSAGE PASSING VS SHARED
MEMORY
• In the shared-memory model, a region of memory that is shared by cooperating processes is
established. Processes can then exchange information by reading and writing data to the shared
region.
• In the message-passing model, communication takes place by means of messages exchanged
between the cooperating processes.
SHARED MEMORY SYSTEM

• Interprocess communication using shared memory requires communicating processes to


establish a region of shared memory.
• And this region of shared memory resides in the address space of the process that creates the
shared memory segment
• Other processes that wish to communicate using this segment must attach it to their address
space.
• Normally OS tries to prevent one process from accessing another process’ memory.
• Shared memory requires that two or more processes agree to remove this restriction
MESSAGE PASSING SYSTEM
• Message passing provides a mechanism to allow processes to
communicate and synchronize their actions without sharing
the same address space and is useful in a distributed
environment where communicating processes may reside on
different computers connected by a network.
• A message passing facility provides at least 2 operations : send
(message) and receive (message).
• Messages can be of either fixed or variable in size.
• If processes P and Q want to communicate they must send
messages to and receive messages from each other. A
communication link must exist between them. This link can be
implemented in a variety of ways, such as direct or indirect,
synchronous or asynchronous communication and automatic
or explicit buffering

You might also like