Changes between Version 65 and Version 66 of processus_thread


Ignore:
Timestamp:
Dec 10, 2017, 6:02:19 PM (7 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v65 v66  
    113113== __5) Thread destruction__ ==
    114114
    115 The destruction of a thread T running in cluster K can be caused by the thread itself, executing the thread_exit() function to suicide. It can also be caused by another thread, executing  the thread_kill() function requesting the target thread to stop execution.
     115The destruction of a thread T running in cluster K can be caused by another thread K, executing  the thread_kill() function requesting the target thread to stop execution. It can also be caused by the thread T itself, executing the thread_exit() function to suicide. 
    116116
    117117=== 5.1) thread kill ===
    118118
    119 The '''thread_kill()''' kernel function can be executed by a thread running in any cluster. It is called by the ''pthread_cancel'' system call, to destroy one single thread, or by the ''kill'' system call, to destroy all threads of a given process. The killer thread requires the target thread scheduler to do the job by writing in the target thread descriptor, and the target scheduler signals completion to the killer by writing in the killer thread descriptor.
     119The '''thread_kill()''' kernel function can be executed by a thread running in any cluster. It is called by the ''pthread_cancel'' system call, to destroy one single thread, or by the ''kill'' system call, (through the process_kill() function), to destroy all threads of a given process. The killer thread requires the target thread scheduler to do the work by writing in the target thread descriptor, and the target scheduler signals completion to the killer by writing in the killer thread descriptor.
    120120
    121  * To request the kill, the killer thread  sets the BLOCKED_GLOBAL bit in the target thread "blocked" field, sets the SIG_KILL bit in the target thread "signals" field, and register in the target thread "kill_rsp" field the address of a response counter allocated in the killer thread stack.
     121 * To request the kill, the killer thread  sets the BLOCKED_GLOBAL bit in the target thread "blocked" field, sets the SIG_KILL bit in the target thread "signals" field, and register in the target thread "kill_xp" field the extended pointer on the killer thread.
    122122 * If the target thread is running on another core than the killer thread, the killer thread send an IPI to the core running the target thread, to ask the target scheduler to handle the request. If the target is running on the same thread as the killer, the killer thread calls directly the sched_handle_signal() function.
    123  * In both cases, the sched_handle_signals() function - detecting the SIG_KILL signal - detach the target thread from the scheduler, detach the target thread from the local process descriptor, release the memory allocated to the target thread descriptor, and atomically decrement the response counter in the killer thread to signal completion.
     123 * In both cases, the sched_handle_signals() function - detecting the SIG_KILL signal - detach the target thread from the scheduler, detach the target thread from the local process descriptor, detach the target thread from the parent thread if it is attached, release the memory allocated to the target thread descriptor, and atomically decrement the response counter in the killer thread to signal completion.
    124124
    125125=== 5.2) thread exit when DETACHED ===