130 | | * 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. |
| 130 | * If it 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. |
145 | | If the exit() system call is executed by a thread running in a cluster K different from the owner cluster Z, the kernel K send a RPC_PROCESS_REQ_EXIT to cluster Z. The argument is the PID. |
| 144 | The exit() is a four steps scenario: |
| 145 | 1. If the exit() system call is executed by a thread running in a cluster K different from the owner cluster Z, the kernel K send a RPC_PROCESS_EXIT to cluster Z. The argument is the calling process PID. |
| 146 | 1. To execute this RPC, the owner kernel Z send a multi-cast RPC_PROCESS_KILL to all clusters X that contain a copy of the process descriptor, using its COPIES_LIST. The argument of this RPC is the target process descriptor pointer. |
| 147 | 1. In each cluster X, the kernel receiving a RPC_PROCESS_KILL sets the FLAG_KILL bit signal in all threads descriptors associated to the target process, and polls the local TH_TBL(X,P). When it detects that the TH_TBL(X,P) is empty, it releases the memory allocated to process descriptor, and acknowledges the RPC to cluster Z. |
| 148 | 1. When the kernel Z has received all expected responses to the multi-cast RPC_PROCESS_KILL, it releases all memory allocated to process PID in cluster Z, and deschedulethis completes the process destruction. |
149 | | To execute this RPC, the owner kernel Z send a multi-cast RPC_PROCESS_EXIT to all clusters X that contain a copy of the process descriptor, using its COPIES_LIST. The argument of this RPC is the PID. |
150 | | |
151 | | === 6.3) phase 3 === |
152 | | |
153 | | In each cluster X, the kernel receiving a RPC_PROCESS_EXIT register the kill signal in all threads descriptors associated to the PID process. and polls the local TH_TBL(X,P). When it detects that the TH_TBL(X,P) is empty, it releases the memory allocated to process descriptor, and acknowledges the RPC to cluster Z. |
154 | | |
155 | | === 6.4) phase 4 === |
156 | | |
157 | | When the kernel Z has received all expected responses to the multi-cast RPC, it releases all memory located to process PID in cluster Z, and this completes the process destruction. |
| 152 | The kill() scenario is identical to the 4 steps exit() scenario above. It is initiated by a kill() system call executed by any thread running in any cluster. |