Operation on processes
Operation on processes – Usually processes execute concurrently in most systems and they can be dynamically created and deleted. A system must offer a mechanism for process creation and process termination.
Creation of a process can be cause of creation many other process which can be called as sub processes, the base process is called as parent process and the sub process is called as child processes. A process can have two or more child processes whether the child processes can also have their child processes the process creation will discuss later in Process creation topic.
The process is terminating when it finishes its execution and all the sub processes of a process completed then the process is finally reach to its termination state. Process terminated when it finishes executing its final statement and ask the operating system to delete its execution by using the exit() system call. Process get terminated when all of its child processes finishes their execution. Further will discuss in process termination topic. A process can be in depended or cooperating.
The process which does not affect or affected by any other process is called as independed process
A process which affect and affected by any other process is called as cooperating processes. IPC, inter process communication is required for cooperating process. There are two models of IPC which are
- Shared memory
- Message passing
In this case the portion of memory is established which is shared by cooperating processes. Information for the processes can be exchange by reading and writing data to the shared region.
Communication can be done by the technique of message passing between cooperating processes
Producer Consumer Problem
Cooperating processes have paradigm producer process produces information and consumer consume the produced information.
- One solution is to use the shared memory for the producer consumer problem.
- For concurrent running of the consumer and producer processes there should have available buffer of items that can be filled by producer and consumed by consumer.
- The buffer resides in the memory region that is shared by consumer and producer processes.
- The produce and the consumer should be coordinated so that the consumer does not try to consume an item that has not so far been produced.
There are two types of buffer that can be used
Bounded Buffer: buffer which is fixed in size or have size limit is called as bounded buffer.
Unbounded Buffer: The buffer with fix size or have specific limit is called as unbounded buffer.