Tutorialspoint

1 Answer
Ricky Barnes
, 12 Views

Cooperating processes are those that can affect or are affected by other processes running on the system. Cooperating processes may share data with each other.

Reasons for needing cooperating processes

There may be many reasons for the requirement of cooperating processes. Some of these are given as follows:

  1. Modularity
  2. Modularity involves dividing complicated tasks into smaller subtasks. These subtasks can completed by different cooperating processes. This leads to faster and more efficient completion of the required tasks.

  3. Information Sharing
  4. Sharing of information between multiple processes can be accomplished using cooperating processes. This may include access to the same files. A mechanism is required so that the processes can access the files in parallel to each other.

  5. Convenience
  6. There are many tasks that a user needs to do such as compiling, printing, editing etc. It is convenient if these tasks can be managed by cooperating processes.

  7. Computation Speedup
  8. Subtasks of a single task can be performed parallely using cooperating processes. This increases the computation speedup as the task can be executed faster. However, this is only possible if the system has multiple processing elements.

Methods of Cooperation

Cooperating processes can coordinate with each other using shared data or messages. Details about these are given as follows:

  1. Cooperation by Sharing
  2. The cooperating processes can cooperate with each other using shared data such as memory, variables, files, databases etc. Critical section is used to provide data integrity and writing is mutually exclusive to prevent inconsistent data.

    A diagram that demonstrates cooperation by sharing is given as follows:

    Cooperating Processes

    In the above diagram, Process P1 and P2 can cooperate with each other using shared data such as memory, variables, files, databases etc.

  3. Cooperation by Communication
  4. The cooperating processes can cooperate with each other using messages. This may lead to deadlock if each process is waiting for a message from the other to perform a operation. Starvation is also possible if a process never receives a message.

    A diagram that demonstrates cooperation by communication is given as follows:

    Cooperating communication in Processes

    In the above diagram, Process P1 and P2 can cooperate with each other using messages to communicate.

Advertisements