Operating System/O.S(Neso Academy, HPC Lab. KOREATECH)

6) Process Creation , Termination ,InterProcess Communication

Tony Lim 2021. 5. 4. 14:36
728x90

A process may create several new processes, via a create-process system call , during the course of execution

creating process = parent process

created new process = children of that parent process

children can create children process , forming a tree processes.

a tree process on a typical Solaris system

 

Parent child Execution

1. The parent continues to execute concurrently with its children. = if children get executed , parent also will be executed. 

2. The parent waits until some or all of its children have terminated. = like recursion parent will wait until children finish. child can all or part of resources from the parent.

 

Parent child address space

1. same(duplicate) = it has the same program and data as the parent 

2. Child process has a new program loaded into it.  

 

Termination

  • a process terminates after executing its final statement and call exit() system call to delete itself. 
  • at that point , child process return a status value to its parent process by wait() system call.
  • all resource are deallocated by the OS.

 

Usually  system call( killing other process ) can be invoked only by the parent of the process that is to be terminated.

 

terminated by parent

  • if the child exceeded its usage of some of the resources that it has been allocated parent might terminate it.
  • if task assigned to the child or entire process tree itself no longer required , parent might terminate it
  • when parent terminate some OS doesn't allow child to continue and terminate child too.

 

InterProcess Communication (IPC)

Process might be independent to each other or dependent(cooperating processes)

any proces that shares data with other processes is a cooperating process.

 

Reason for Cooperation 

Shared Information need to be concurrent either read or write.  = less resoruces

breaking down to serveral different task as a process and run them concurrently. = computation speed up

Modularity , Convenience 

 

IPC model

1. Shared memory = establish shared memory region and all the cooperative process can read or write data there.

2. Message passing = communication takes place by means of messages exchange between the cooperating processes.

A wants to communciate to B

1) Process A will wirte to "Shared" and Process B will read and B will understand what A required.

2) A sends message to kernel , kernel knows it is for B and send to B.

728x90