There is no problem in process execution if processes are executed one by one and independently. But the problem occurs when more than one process is processing at the same time and utilizing the same resources of the CPU. Our operating system is designed to perform parallel processing and in parallel processing, the resources are shared between various execution of the programs, the complete environment of our operating system is based on multitasking and in this case, there can exist some processes which are cooperative processes and depend on each other for their execution. The cooperative process requires the use of resources and the instructions of the other processes. Apart from cooperative processes there exist independent processes that do not require the resources as well as instruction for its execution.
If the cooperative processes are not synchronized then these processes can create problems for one another. As they share the resources, memory, code, CPU so if one process is on execution and changes the variable which is common to one another then the execution of the future process which will use the same variable will go in an error because of the change in the variable.
The consumer-producer problem is one of the classic examples of how the cooperative process functions. The consumer can only consume the information when the producer produces it and has to wait with the producer to stop. The producer produces information for the consumer but has to wait when there is no place to put it.
The cooperative process utilizes the inter-process communication (IPC) to communicate with each other and that allows us to share the information data and information with each other. The cooperative process is able to do this with the help of two mechanisms. It can be done with either sharing the memory in which the shared region of the area is used to read and write the code or it can be done with memory parsing which involves the exchange of information between various processes.
There are various advantages of using the cooperative processes in the operating system these are
For the execution of the cooperative processes the variable has to be shared between by each of them because one user can try to access the same variable from one person’s and the other user can try to access the same shared information from the other process therefore we need an environment which allows sharing of the information between various users and processes in the same operating system.
Increase in computation
the processes are created when the programs are subdivided for execution. when the programs are divided into subprograms these are called processes. The independent process can speed up the computation of the main program then it would have been if it is executed without these subdivisions.
When we are designing a system then these systems are divided into modules. The work on these modules is done separately, later on when each of the models is completed in execution then these models are combined to form a single system. The module requires communication of processes with each other to achieve a single goal and therefore we need the cooperative processes.
When the user is he performing a various task such as listening to music, writing on the notepad, watching a video, playing a video game then these all task have to be performed concurrently and also requires sharing of CPU, memory then it becomes very essential to handle this process in intercommunicating environment and the role of cooperative process in making multitasking work is very essential.