Changes between Version 95 and Version 96 of processus_thread


Ignore:
Timestamp:
May 13, 2018, 12:54:41 PM (7 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v95 v96  
    160160The process descriptors copies (other than the process descriptor in owner cluster) are simply deleted by the scheduler when the last thread of a given process in a given cluster is  deleted. The process descriptor copy is removed from the list of copies in the owner process cluster descriptor, and the process copy disappears.
    161161
    162 The process destruction in the owner cluster is more complex, because the child process destruction must be reported to the parent process when the parent process executes the blocking sys_wait() system call. Therefore, the child process destruction cannot be done before the parent calls the sys_wait() function. As the '''sys_wait()''' function, and the '''sys_kill()''' or '''sys_exit()''' function are executed by different threads running in different clusters, this requires a parent/child synchronization:
    163 After a sys-kill() or sys_exit(), the process descriptor in owner cluster is kept in ''zombi'' state :  the main thread (i.e. thread 0 in process owner cluster) is not deleted until the sys_wait() syscall is executed by the parent process.  This synchronization uses the '''term_state'''  field in the child process descriptor, that contains the following informations :
     162The process destruction in the owner cluster is more complex, because the child process destruction must be reported to the parent process when the main thread of the parent process executes the blocking sys_wait() system call (in the parent owner cluster). Therefore, the child process in owner cluster cannot be destroyed before the parent calls the sys_wait() function. As the '''sys_wait()''' function, and the '''sys_kill()''' or '''sys_exit()''' function are executed by different threads running in different clusters, this requires a parent/child synchronization. To keep a process descriptor in ''zombi'' state after a sys-kill() or sys_exit(), the main thread (i.e. thread 0 in process owner cluster) is not deleted until the sys_wait() syscall is executed by the parent process main thread.  This synchronization uses the '''term_state'''  field in process descriptor, that contains the following informations :
    164163 * the PROCESS_FLAG_KILL  indicates that a KILL request has been received by the child; 
    165164 * the PROCESS_FLAG_EXIT indicates that an EXIT  request has been made by the child; 
    166165 * the PROCESS_FLAG_BLOCK indicates that a SIGSTOP signal has been received by the child;
    167166 * the PROCESS_FLAG_WAIT flag indicates that a WAIT  request from parent has been received by the child and reported to parent.
    168  * moreover, for an exit(),  the exit() argument is registered in this ''term_state'' field.
     167 * moreover, for an exit(),  the exit() argument value is registered in this ''term_state'' field.
    169168
    170 The actual deletion of the process descriptor in owner cluster is done by the sys_wait() function, that must be executed by the parent main thread (i.e. thread 0 in parent owner cluster). This sys_wait() function executes an infinite loop. At each iteration the parent main thread scan all children owner descriptors. When it detects that one child terminated,
    171 it set the PROCESS_FLAG_WAIT in child process descriptor, set the THREAD_FLAG_DELETE in the child main thread, and returns to report the child termination state to parent process. It is the responsibility of the parent process to re-enter the sys_wait() syscall for the other children. When the parent process does not detect a terminated child at the end of an iteration, it deschedules without blocking. 
     169The actual deletion of the child owner process descriptor and child main thread are done by the sys_wait() function, executed by the parent main thread (i.e. thread 0 in parent owner cluster). This sys_wait() function executes an infinite loop. At each iteration the parent main thread scan all children owner descriptors. When it detects that one child terminated, it set the PROCESS_FLAG_WAIT in child owner process descriptor, set the THREAD_FLAG_DELETE in the child main thread, and returns to report the child termination state to parent process. It is the responsibility of the parent process to re-enter the sys_wait() syscall for the other children. When the parent process does not detect a terminated child at the end of an iteration, it deschedules without blocking. 
    172170
    173171