Changes between Version 50 and Version 51 of processus_thread


Ignore:
Timestamp:
Dec 7, 2017, 10:14:16 AM (7 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v50 v51  
    124124== __5) Thread destruction__ ==
    125125
    126 The destruction of a thread T running in cluster K can be caused by the thread itself, executing the thread_exit() function. It can also be caused by another thread, executing the thread_kill() requesting the target thread to stop execution. In both case, the host kernel K is in charge of the destruction. The scenario is more complex if the finishing thread T is running in DETACHED mode, because the parent thread TP must be informed of the completion of thread T, in case of pthread_join() executed by TP.
     126The destruction of a thread T running in cluster K can be caused by the thread itself, executing the thread_exit() function. It can also be caused by another thread, executing the thread_kill() function requesting the target thread to stop execution. In both case, the host kernel K is in charge of the destruction. The scenario is more complex if the finishing thread T is running in DETACHED mode, because the parent thread TP must be informed of the completion of thread T, in case of pthread_join() executed by TP.
    127127
    128128=== 5.1) thread_exit ===
    129129
    130130 * If T is running in DETACHED mode, the calling thread T sets the FLAG_SUICIDE bit in the "flags" bit_vector, registers the BLOCKED_GLOBAL bit in the "blocked" bit_vector, and de-schedule. The scheduler, detecting the FLAG_SUICIDE bit, remove the thread from the scheduler list, remove the thread from its process, and destroys the thread descriptor.
    131  * If it is running in ATTACHED mode, the calling thread T sets the BLOCKED_EXIT bit in the "blocked" bit vector and de-schedule.  The FLAG_KILL bit in the "flags" bit-vector,  and the BLOCKED_EXIT bit are set by the parent thread TP (using remote  accesses) when it executes the pthread_join(), and detects the BLOCKED_EXIT bit in thread T. The scenario is the standard kill described below.
     131 * If it is running in ATTACHED mode, the calling thread T sets the BLOCKED_EXIT bit in the "blocked" bit vector and de-schedule.  The FLAG_KILL bit in the "flags" bit-vector,  and the BLOCKED_EXIT bit are set by the parent thread TP (using remote  accesses) when it executes the pthread_join(), and detects the BLOCKED_EXIT bit in thread T. The scenario is then the kill scenario described below.
    132132
    133133=== 5.2) thread_kill ===
    134134
    135 This is a three steps scenario:
    136 
    137  1. The killer thread uses a remote access to set the BLOCKED_GLOBAL bit in the target thread "blocked" bit_vector, set the FLAG_KILL bit in the target thread "signals" bit_vector, and send an IPI to the target thread core to force scheduling.
    138  1. The target thread scheduler, detecting the FLAG_KILL bit set, removes the thread from the scheduler list, and reset the FLAG_KILL bit to acknowledge the killer.
    139  1. The killer thread poll the FLAG_KILL bit in the target thread until reset, detach the thread from its parent if the thread is attached, and destroys the target thread, using a RPC_THREAD_DESTROY if the target thread is remote.
    140 
    141 
    142 
    143 === 5.3) phase 3 ===
    144 
    145 In each cluster, a dedicated kernel thread is in charge of housekeeping: This thread releases the memory allocated to all DEAD threads.
     135The killer thread uses a remote access to set the BLOCKED_GLOBAL bit in the target thread "blocked" bit_vector, set the FLAG_KILL bit in the target thread "signals" bit_vector, and send an IPI to the target thread core to force scheduling.
     136The target thread scheduler, detecting the FLAG_KILL bit set, removes the thread from the scheduler list, removes the thread from the local process descriptor, and finally destroys the thread descriptor.
    146137
    147138== __6) Process destruction__ ==