Page 60 - DCAP403_Operating System
P. 60

Unit 4: Process Management





                                     Figure 4.3: Process Hierarchies                            Notes

                                        Root Node                         Level 0




                      Child#1            Child#2              Child#3     Level 1





                                                                          Level 2


          The processes are linked by a tree structure. If a parent is signaled or killed, usually all its children
          receive the same signal or are destroyed with the parent. This doesn’t have to be the case – it is
          possible to detach children from their parents – but in many cases it is useful for processes to be
          linked in this way.
          When a child is created it may do one of two things.
          1.   Duplicate the parent process.
          2.   Load a completely new program.

          Similarly the parent may do one of two things.
          1.   Continue executing along side its children.

          2.   Wait for some or all of its children to finish before proceeding.
          The specific attributes of the child process that differ from the parent process are:

          1.   The child process has its own unique process ID.
          2.   The parent process ID of the child process is the process ID of its parent process.
          3.   The child process gets its own copies of the parent process’s open  fi le  descriptors.

               Subsequently changing attributes of the file descriptors in the parent process won’t affect

               the file descriptors in the child, and vice versa. However, the file position associated with

               each descriptor is shared by both processes.
          4.   The elapsed processor times for the child process are set to zero.
          5.   The child doesn’t inherit file locks set by the parent process.

          6.   The child doesn’t inherit alarms set by the parent process.
          7.   The set of pending signals for the child process is cleared. (The child process inherits its
               mask of blocked signals and signal actions from the parent process.)

          4.3.2 Process State Transitions


          Blocking: It occurs when process discovers that it cannot continue. If running process initiates an
          I/O operation before its allotted time expires, the running process voluntarily relinquishes the
          CPU.

          This state transition is:
          Block: Running? Block.
          Time-Run-Out: It occurs when the scheduler decides that the running process has run long
          enough and it is time to let another process have CPU time.




                                           LOVELY PROFESSIONAL UNIVERSITY                                    53
   55   56   57   58   59   60   61   62   63   64   65