Changes between Version 88 and Version 89 of processus_thread


Ignore:
Timestamp:
Mar 1, 2018, 5:30:58 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v88 v89  
    141141This destruction mechanism can involve three threads: the target thread T, the killer thread K, and the joining thread J:
    142142
    143 It uses three specific fields in the thread descriptor: the ''join_lock'' field is a remote_spin_lock; the ''join_value'' field contains the termination status returned by the T thread; the ''join_xp'' field contains an extended pointer on the first arrived thread. It uses also two specific THREAD_FLAG_JOIN_DONE and THREAD_FLAG_KILL_DONE flags in the thread descriptor ''flags'' field, and one specific blocking bit THREAD_BLOCKED_JOIN, in the ''blocked'' field.
     143It uses two specific fields in the thread descriptor: the ''join_lock'' field is a remote_spin_lock, and the ''join_xp'' field contains an extended pointer on the first arrived thread. It uses also two specific THREAD_FLAG_JOIN_DONE and THREAD_FLAG_KILL_DONE flags in the target thread descriptor ''flags'' field, and one specific blocking bit THREAD_BLOCKED_JOIN, in the ''blocked'' field.
    144144
    145145 * Both the killer thread K, executing the thread_kill() function), and the joining thread J, executing the sys_thread_join() function, try to take the ''join_lock'' implemented in the T thread descriptor (the ''join_lock'' in the J thread is not used).
    146146 * The K thread test the FLAG_JOIN_DONE in the T thread descriptor:
    147147   * If the FLAG_JOIN_DONE is set, the J thread arrived first and is blocked on the BLOCKED_JOIN condition: the K thread unblock the J thread from the BLOCKED_JOIN condition (using the ''join_xp'' field in the T thread), reset the JOIN_DONE flag in T thread, releases the ''join_lock'' in T thread, and completes the T thread destruction as described in the detached case.
    148    * If the FLAG_JOIN_DONE is not set, the K thread arrived first: the K thread blocks the K thread on the BLOCKED_JOIN condition, set the FLAG_KILL_DONE in the T thread, register the killer thread extended pointer in the T thread ''join_xp'' field, releases the ''join_lock'' in the T thread, and deschedules. It completes the T thread destruction as described in the detached case when it resumes.
     148   * If the FLAG_JOIN_DONE is not set, the K thread arrived first: the K thread blocks the K thread on the BLOCKED_JOIN condition, set the FLAG_KILL_DONE in the T thread, register the killer thread extended pointer in the T thread ''join_xp'' field, releases the ''join_lock'' in the T thread, and deschedules. It completes the T thread destruction as described in the detached case when it is unblocked by the J thread.
    149149 * The J thread test the FLAG_KILL_DONE in the T thread descriptor:
    150    * If the FLAG_KILL_DONE is set, the K thread arrived first and is blocked on the BLOCKED_JOIN condition: the J thread reset the BLOCKED_JOIN bit in the K thread, get the exit value from the T thread "join_value" field, releases the "join_lock" in T thread, and return.
    151    * If the FLAG_KILL_DONE is not set, the J thread arrived first: the J thread register its extended pointer in the T thread "join_xp" field, set the FLAG_JOIN_DONE in the T thread, sets the BLOCKED_EXIT bit in the J thread, releases the "join_lock" in the T thread, and deschedules. It will get the exit value  from the T thread "join_value" field and return when it resumes.
     150   * If the FLAG_KILL_DONE is set, the K thread arrived first and is blocked on the BLOCKED_JOIN condition: the J thread reset the BLOCKED_JOIN bit in the K thread, releases the "join_lock" in T thread, and returns.
     151   * If the FLAG_KILL_DONE is not set, the J thread arrived first: the J thread register its extended pointer in the T thread "join_xp" field, set the FLAG_JOIN_DONE in the T thread, sets the BLOCKED_EXIT bit in the J thread, releases the "join_lock" in the T thread, and deschedules. It simply returns when it is unblocked by the K thread.
    152152
    153153== __6) Process destruction__ ==