150 | | The exit() is a four steps scenario: |
151 | | 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. |
152 | | 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. |
153 | | 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. |
154 | | 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. |
| 150 | To handle the exit( value ) system call, the client thread, executing the sys_exit() function, send the RPC_PROCESS_EXIT to the owner cluster of the client process. We use a RPC even if the thread executing the exit() is running in the owner cluster, because the killer thread cannot be the client thread. From this point all the work is done by the RPC in owner cluster. |
158 | | 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. |
| 154 | To handle the kill( pid ) system call, the client thread, executing the sys_kill() function, send the RPC_PROCESS_KILL to the owner cluster of the process identified by the "pid" argument. We use a RPC even if the thread executing the kill() is running in the owner cluster, because a process can kill itself, and the killer thread cannot be the client thread. From this point all the work is done by the RPC in owner cluster. |
| 155 | |
| 156 | === 6.3) destruction scenario === |
| 157 | |
| 158 | 1. The RPC thread in owner cluster send a multicast and parallel RPC_PROCESS_BLOCK to all clusters containing a copy of the process. In each cluster, this RPC_PROCESS_BLOCK set the BLOCKED_GLOBAL bit and the KILL or EXIT signal |
| 159 | for all threads of the process. It returns only when all threads are blocked and descheduled. |
| 160 | 1. When the RPC thread in owner cluster has received all expected responses to the multi-cast RPC_PROCESS_BLOCK, it send another multicast and parallel RPC_PROCESS_RELEASE to all clusters containing a copy of the process. In each cluster, this RPC releases all memory allocated to the local threads and process. |
| 161 | 1. When the RPC thread in owner cluster has received all expected responses to the multi-cast RPC_PROCESS_RELEASE, |
| 162 | it updates the owner cluster manager to remove the process from the set of owned processes, and this complete the process destruction. |