Tuesday, November 14, 2023

Operations on Processes

Operations on Processes

The processes in the most systems can execute concurrently and they may be created and deleted dynamically.

Process Creation

During execution a process may create several new processes. Each of these new processes may in turn create other processes forming a tree of processes.

Most operating systems identify processes according to a unique process identifier(Pid).


When a process creates a new process, two possibilities for execution exist:
1. The parent continues to execute concurrently with its children.
2. The parent waits until some or all of its children have terminated.

There are also two address space possibilities for the new process:
1. The child process is a duplicate of the parent process (same program and data)
2. The child process has a new program loaded into it.


fig: process creation using fork() system call.

Process Termination

A process terminates and asks the operating system to delete it by using exit() system call.

A parent may terminate the execution of one of its children for variety of reasons:
1. the child exceeded its usage of allocated resources.
2. the task of child is no longer required.
3. the parent is exiting. (cascading termination)

A parent process may wait for termination of a child process by using the wait() system call.

When a process terminates, all of its system resources are freed up, open files flushed and closed, etc. The process termination status and execution times are returned to the parent if the parent is waiting for the child to terminate, or eventually returned to init if the process becomes an orphan. ( Processes which are trying to terminate but which cannot because their parent is not waiting for them are termed zombies. These are eventually inherited by init as orphans and killed off.)

0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top