Changes between Version 105 and Version 106 of processus_thread


Ignore:
Timestamp:
Aug 22, 2018, 6:01:44 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v105 v106  
    127127The destruction of a target thread T can be caused by another thread K, executing  the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_thread_cancel.c pthread_cancel()] syscall requesting the target thread T to stop execution. It can be caused by the thread T itself, executing the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_thread_exit.c pthread_exit()] syscall to suicide. Finally, it can be caused by the  [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_exit.c exit()] or [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_kill.c kill()] syscalls requesting the destruction of all threads of a given process.
    128128
    129 The unique method to destroy a thread is to call the '''thread_kill()''' function, that sets 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.
    130 The scheduler calls the ''thread_destroy()'' function that detaches the thread from the scheduler, detaches 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).
     129The unique method to destroy a thread is to call the '''thread_delete()''' function, that sets 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.
     130The scheduler calls the ''thread_destroy()'' function that detaches the thread from the scheduler, detaches the thread from the local process descriptor, and releases the memory allocated to the thread descriptor. The '''thread_delete()''' function can be called by the target thread itself (for an exit), or by another thread (for a kill).
    131131
    132 If the target thread is running in attached mode, the '''thread_kill()''' function synchronizes with the joining thread, waiting the actual execution of the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_thread_join.c pthread_join()] syscall before marking the target thread for delete.
     132If the target thread is running in attached mode, the '''thread_delete()''' function synchronizes with the joining thread, waiting the actual execution of the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_thread_join.c pthread_join()] syscall before marking the target thread for delete.
    133133
    134 If the target thread is the main thread (i.e. the thread 0 in the process owner cluster) the  '''thread_kill()''' does not mark the target thread for delete, because this must be done by the parent process main thread executing the ''sys_wait()'' syscall (see section [6] below).   
     134If the target thread is the main thread (i.e. the thread 0 in the process owner cluster) the  '''thread_delete()''' does not mark the target thread for delete, because this must be done by the parent process main thread executing the [https://www-soc.lip6.fr/trac/almos-mkh/browser/trunk/kernel/syscalls/sys_wait.c wait()] syscall (see section [6] below).   
    135135
    136136=== 5.1) Thread running in DETACHED mode ===