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

Cooperating Processes in Operating System

Cooperating processes in an operating system can affect or be affected by other processes, sharing data through shared memory or message passing. They enhance efficiency through information sharing, computation speed, convenience, and modularity, but can also lead to issues like deadlock and process starvation. Understanding these processes is essential for effective resource management within various types of operating systems.

Uploaded by

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

Cooperating Processes in Operating System

Cooperating processes in an operating system can affect or be affected by other processes, sharing data through shared memory or message passing. They enhance efficiency through information sharing, computation speed, convenience, and modularity, but can also lead to issues like deadlock and process starvation. Understanding these processes is essential for effective resource management within various types of operating systems.

Uploaded by

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

Cooperating Processes in Operating System

There may be several processes running in the system at the same time which
can be either cooperating processes or independent processes.

An independent process cannot be impacted or affected by other processes.

Cooperating Process in OS is a process that can affect or get affected by any


other process under execution.

What are Cooperating Processes in the Operating System?


Before learning about Cooperating processes in operating systems let's learn a
bit about Operating Systems and Processes.

There are two types of software first is the application software and the other
is the system software.

An application software performs tasks for the user while system


software operates and controls the computer system and works as an interface
to run the application software.

Operating system is system software that manages the resources of a computer


system that is both hardware and software. It works as an interface between the
user and the hardware so that the user can interact with the hardware. It
provides a convenient environment in which a user can execute the programs.
An operating system is a resource manager and it hides the internal working
complexity of the hardware so that users can perform a specific task without
any difficulty.

Some widely used operating systems are:

 Single-process operating system


 Batch-processing operating system
 Multiprogramming operating system
 Multitasking operating system
 Multi-processing operating system
 Distributed operating system
 Real-Time operating system
Now, Lets's talk about how the process is the most important part of an
operating system:

A program under execution is known as the process. Every task in an operating


system is converted into a process. A process has several states from its start to
its termination. After a new process is generated the process gets admitted into a
ready queue by job scheduler or long-term scheduler where every process is
ready for execution. Then the processes inside the ready queue are admitted into
the execution state by CPU scheduler or short-term scheduler. After
execution, the process gets terminated.

Before termination, there may be multiple processes being executed in a system.


There are two modes in which the processes can be executed. These two modes
are:

1. Serial mode
2. Parallel mode

In serial mode, the process will be executed one after the other means the next
process cannot be executed until the previous process gets terminated.

On the contrary in parallel mode, there may be several processes being


executed at the same time quantum. In this way, there will be two types of
processes which can be either cooperating processes or independent
processes.

Cooperating Process in the operating system is a process that gets affected by


other processes under execution or can affect any other process under execution.
It shares data with other processes in the system by directly sharing a logical
space which is both code and data or by sharing data
through files or messages.

Whereas, an independent process in an operating system is one that does not


affect or impact any other process of the system. It does not share any data with
other processes.
Methods of Cooperating Process in OS

Cooperating processes in OS requires a communication method that will allow


the processes to exchange data and information.

There are two methods by which the cooperating process in OS can


communicate:

 Cooperation by Sharing
 Cooperation by Message Passing

Details about the methods are given below:

Cooperation by Sharing

The cooperation processes in OS can communicate with each other using the
shared resource which includes data, memory, variables, files, etc.

Processes can then exchange the information by reading or writing data to the
shared region. We can use a critical section that provides data integrity and
avoids data inconsistency.

Let's see a diagram to understand more clearly the communication by shared


region:

In the above diagram, We have two processes A and B which are


communicating with each other through a shared region of memory.
Process A will write the information in the shared region and then
Process B will read the information from the shared memory and that's how the
process of communication takes place between the cooperating processes by
sharing.
Cooperation by Message Passing

The cooperating processes in OS can communicate with each other with the
help of message passing. The production process will send the message and the
consumer process will receive the same message.

There is no concept of shared memory instead the producer process will first
send the message to the kernel and then the kernel sends that message to the
consumer process.

A kernel is known as the heart and core of an operating system. The kernel
interacts with the hardware to execute the processes given by the user space. It
works as a bridge between the user space and hardware. Functions of the kernel
include process management, file management, memory management,
and I/O management.

If a consumer process waits for a message from another process to execute a


particular task then this may cause a problem of deadlock and if the consumer
process does not receive the message then this may cause a problem of process
starvation.

Let's see a diagram to understand more clearly the cooperation by


communication:

In the above diagram, the processes A and B are communicating with each
other. Process A first sends the message to the kernel and then the kernel will
interpret that this message is meant for Process B.

The kernel then sends the message to the process P2 and that's how the process
of communication takes place between the cooperation processes by
communication.
Need of Cooperating Processes in OS
One process will write to the file and the other process reads the file. Therefore,
every process in the system could be affected by the other process.

The need for cooperating processes in OS can be divided into four types:

1. Information Sharing
2. Computation Speed
3. Convenience
4. Modularity

Let's learn about them in detail.

Information Sharing

As we know the cooperating process in OS shares data and information between


other processes. There may be a possibility that different processes are
accessing the same file. Processes can access the files concurrently which
makes the execution of the process more efficient and faster.

Computation Speed

When a task is divided into several subtasks and starts executing them
parallelly, this improves the computation speed of the execution and makes
it faster. Computation speed can be achieved if a system has multiple
CPUs and input/output devices.

When the tasks are assigned into several subtasks they become several different
processes that need to communicate with each other. That's why we need
cooperating processes in the operating system.

Convenience

A user may be performing several tasks at the same time which leads to the
running of different processes concurrently. These processes need to cooperate
so that every process can run smoothly without interrupting each other.

Modularity

We want to divide a system of complex tasks into several different modules and
later they will be established together to achieve a goal. This will help in
completing tasks with more efficiency as well as speed.
Advantages of Cooperating Process in Operating System
Let's discuss several advantages of cooperating processes in the operating
system:

 With help of data and information sharing, the processes can be executed
with much faster speed and efficiency as processes can access the same
files concurrently.
 Modularity gives the advantage of breaking a complex task into several
modules which are later put together to achieve the goal of faster
execution of processes.
 Cooperating processes provide convenience as different processes
running at the same time can cooperate without any interruption among
them.
 The computation speed of the processes increases by dividing processes
into different subprocesses and executing them parallelly at the same
time.

Disadvantages of Cooperating Process in Operating


System
Let's discuss the disadvantages of cooperating processes in the operating
system:

 During the communication method of the cooperation processes, there


may be a problem of deadlock if a consumer process waits for the
message from the production process and the message does not receive at
the consuming end.
 There may be a condition of process starvation where the next process
will have to wait until the message is received by the previous consuming
process.
 The cooperating processes in the operating system can damage the data
which may occur due to modularity.
 During information sharing, it may also share any sensitive data of the
user with the other process that the user might not want to share.

You might also like