Changes between Version 91 and Version 92 of processus_thread
- Timestamp:
- Mar 7, 2018, 8:44:51 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
processus_thread
v91 v92 63 63 * '''FLAGS''' : bit_vector of thread attributes. 64 64 * '''BLOCKED''' : bit_vector of blocking causes. 65 * '''SIGNALS''' : bit vector permettant d’enregistrer les signaux reçus par le thread.66 65 * '''PROCESS''' : pointer on the local process descriptor 67 66 * '''SCHED''' : pointer on the scheduler in charge of this thread. … … 122 121 The destruction of a target thread T can be caused by another thread K, executing the ''pthread_cancel()'' sys call requesting the target thread T to stop execution. It can be caused by the thread T itself, executing the ''pthread_exit()'' sys call to suicide. Finally, it can be caused by the ''exit()'' or ''kill()'' syscalls requesting the destruction of all threads of a given process. 123 122 124 The unique method to destroy a thread is to call the '''thread_kill()''' function, that set the THREAD_FLAG_REQ_DELETE bit in the ''flags'' field of the target thread descriptor. The thread will be asynchronously deleted by the scheduler at the next scheduling point ,125 that calls the ''thread_destroy()'' function. This functiondetach the thread from the scheduler, detach the thread from the local process descriptor, and releases the memory allocated to the thread descriptor. The '''thread_kill()''' function can be called by the target thread itself (for an exit), or by another thread (for a kill).123 The unique method to destroy a thread is to call the '''thread_kill()''' function, that set the THREAD_FLAG_REQ_DELETE bit in the ''flags'' field of the target thread descriptor. The thread will be asynchronously deleted by the scheduler at the next scheduling point. 124 The scheduler calls the ''thread_destroy()'' function that detach the thread from the scheduler, detach the thread from the local process descriptor, and releases the memory allocated to the thread descriptor. The '''thread_kill()''' function can be called by the target thread itself (for an exit), or by another thread (for a kill). 126 125 127 126 If the target thread is running in attached mode, the '''thread_kill()''' function synchronize with the joining thread, waiting the actual execution of the pthread_join() syscall before marking the target thread for delete. … … 152 151 * If the FLAG_KILL_DONE is set, the K thread arrived first and is blocked on the BLOCKED_JOIN condition: the J thread unblocks the killer thread, reset the FLAF_KILL_DONE in the T thread, releases the "join_lock" in T thread, and returns. 153 152 * 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. 154 155 === 5.3) main thread destruction ===156 153 157 154 == __6) Process destruction__ ==