99 | | After a fork() system call, any thread of the the P process can execute an exec() system call. This system call forces the P process to execute a new application, while keeping the same PID, |
100 | | the same parent process, all open file descriptors, and the environment variables. The existing P process descriptors (both the reference and the copies) and all associated threads are destroyed. A new process descriptor and a new main thread descriptor are created in the reference cluster, and initialized from values found in the existing process descriptor, and from values contained in the .elf file defining the new application. The calling thread can run in any cluster. If the reference cluster Z for process P is different from the calling thread cluster X, the calling thread must use a RPC to ask the reference cluster Z to do the work. |
| 98 | After a fork() system call, any thread of the the P process can execute an exec() system call. This system call forces the P process to execute a new application, while keeping the same PID, the same parent process, all open file descriptors, and the environment variables. The existing P process descriptors (both the reference and the copies) and all associated threads will be destroyed. A new process descriptor and a new main thread descriptor are created in the reference cluster, and initialized from values found in the existing process descriptor, and from values contained in the .elf file defining the new application. The calling thread can run in any cluster. If the reference cluster Z for process P is different from the calling thread cluster X, the calling thread must use a RPC to ask the reference cluster Z to do the work. |
110 | | If the target cluster M is different from the client cluster, the cluster K send a RPC_THREAD_USER_CREATE request to cluster M. The argument is a complete structure pthread_attr_t (defined in the ''thread.h'' file in ALMOS-MK), containing the PID, the function to execute and its arguments, and optionally, the target cluster and target core. This RPC should return the thread TRDID. The detailed scenario is the following: |
| 108 | If the target cluster M is different from the client cluster, the cluster K send a RPC_THREAD_USER_CREATE request to cluster M. The argument is a complete structure pthread_attr_t (defined in the ''thread.h'' file in ALMOS-MK), containing the PID, the function to execute and its arguments, and optionally, the target cluster and target core. This RPC should return the thread TRDID. |
112 | | 1. The kernel M checks if it contains a copy of the P process descriptor. |
113 | | 1. If not, the kernel M creates a process descriptor copy from the reference P process descriptor, using a remote_memcpy(), and using the cluster_get_reference_process_from_pid() to get the extended pointer on reference cluster. It allocates memory for the associated structures GPT(M,P), VSL(M,P), FDT(M,P). It initializes (partially) these structures by using remote_memcpy() from the reference cluster. The PG_TBL structure will be filled by the page faults. |
114 | | 1. The kernel M register this new process descriptor in the COPIES_LIST and LOCAL_LIST. |
115 | | 1. When the local process descriptor is set, the kernel M select the core that will execute the thread, allocates a TRDID to this thread, and creates the thread descriptor for NT. |
116 | | 1. The kernel M registers the thread descriptor in the local process descriptor TH_TBL(M,P), and in the selected core scheduler. |
117 | | 1. The kernel M returns the TRDID to the client cluster K, and acknowledge the RPC. |
| 110 | * If the target cluster M does not contain a copy of the P process descriptor, the kernel M creates a process descriptor copy from the reference P process descriptor, using a remote_memcpy(), and using the cluster_get_reference_process_from_pid() to get the extended pointer on reference cluster. It allocates memory for the associated structures GPT(M,P), VSL(M,P), FDT(M,P). These structures being used as read-only caches will be dynamically filled by the page faults. This new process descriptor is registered in the COPIES_LIST and in the LOCAL_LIST. |
| 111 | * When the local process descriptor is set, the kernel M select the core that will execute the new thread, allocates a TRDID to this thread, creates the thread descritor, and registers it in the local process descriptor, and in the selected core scheduler. |
| 112 | |