96 | | A thread of parent process P, running in a cluster K, executes the fork() system call to create a new process C on a remote cluster Z, that will become the owner for the C process. ALMOS-MK creates the first C process descriptor in the same cluster as the parent cluster P, and postpone the costly remote copy of VSL and GPT from P to C, because this copy is useless in case of exec(). When the fork() system call returns, the C process owner cluster is Z, but the reference process descriptor is in cluster K. The child process and the associated main thread will be migrated to cluster Z later, when the child process makes an "exec" or any other system call. |
97 | | |
98 | | 1. the cluster K allocates memory in K for the reference process descriptor of C, and get a pointer on this process descriptor. |
99 | | 1. the cluster K ask to kernel Z to allocate a PID for the C process, and to register the process descriptor extended pointer in its PREF_TBL(Z). It uses the RPC_PROCESS_PID_ALLOC that takes the process descriptor pointer as argument and returns the PID. |
100 | | 1. after RPC completion, the kernel K initializes the C process descriptor from informations found in the P parent process descriptor. |
101 | | 1. the kernel K creates locally the main thread of process C, and register this thread in the TH_TBL(K,C), |
102 | | 1. the kernel K register this new thread in the scheduler of the core executing the fork() system call, an return. |
103 | | |
104 | | At the end of the fork(), the owner cluster for the new C process is cluster Z, and the reference cluster is cluster K. This C process contains one single thread running on K. |
| 93 | At the end of the fork(), cluster Y is both the owner cluster and the reference cluster for the new C process, that contains one single thread running in the Y cluster. |
| 94 | All pages of DATA, REMOTE, and MMAP vsegs are marked ''Copy On Write'' in the child C process GPT (clusters Y), and in all copies of the parent P process GPT (all clusters containing a copy of P). |