Introduction to Operating Systems: Unit II(a): Process Management

Operation on Processes

Process Management - Introduction to Operating Systems

• Following operations are performed on the process : 1. Process creation 2. Process termination

Operations on Processes

• Following operations are performed on the process :

1. Process creation 

2. Process termination

• A mechanism for process creation and termination via system calls. Programmers usually access these system calls via application interface (API) / library.

Process Creation

• Operating system creates the process in following situations:

1. Starting of new batch job.

2. User request for creating new process.

3. To provide new services by OS. 

4. System call from currently running process. 

• Operating system creates a new process with the specified or default attributes and identifier. A process may create several new sub-process.

• Parent process is creating process and the new processes are called the children of the process. When operating system creates process, it builds the data structure for managing process and allocates address space in primary main memory.

• Operating system creates foreground and background process. Process is identified cor by unique process identifier (PID) in UNIX and windows operating system. PID value is an integer number.

• All processes in UNIX are created using the fork() system call. The forking process is called the parent process. The new process is called the child process.

• Both the parent and child process have their own and private memory. Open files are shared between parent and child.

• If the parent changes the value of its variable, the modification will only affect the variable in the parent process's address space. Other address spaces created by fork() calls will not be affected even though they have identical variable names.

• When a process is created, OS assigns some attributes. These are priority, privilege level, requirement of memory, access right, memory protection, PID etc. To perform operation, process needs software and hardware resources. It includes CPU time, files, memory, I/O device.

• Relation between parent process and child process is as follows:

1. Parent process continues to execute concurrently with its child process.

2. Parent process waits until some or all of its children have terminated.

void main()

{

printf("Operating System\n");

fork();

printf("Technical Publications\n");

return 0;

}

• In above program Operating System is printed only once and Technical Publications is printed two times.

Process Termination

• When process finishes its normal execution then that process is terminate. Operating system delete that process using exit () system call. After deleting process, memory space becomes free.

• OS passes the child's exit status to the parent process and then discards the process. At the same time, it de-allocate all the resources hold by this process. Following are the various reasons for process termination :

1. Normal completion of operation 

2. Memory is not available

3. Time slice expired                       

4. Parent termination

5. Failure of I/O                               

6. Request from parent process

7. Misuse of access rights

Introduction to Operating Systems: Unit II(a): Process Management : Tag: : Process Management - Introduction to Operating Systems - Operation on Processes