78 | | 1. the process P in cluster K allocates memory in K to store the reference process descriptor of F, and get a pointer on this process descriptor using the process_alloc() function. |
79 | | 1. the process P in cluster K ask to kernel Z to allocate a PID for the F process, and to register the process descriptor extended pointer in PREF_TBL(Z) of cluster Z manager. This is done by the RPC_PROCESS_PID_ALLOC that takes the process descriptor pointer as argument and returns the PID. |
80 | | 1. the process P in kernel K initializes the F process descriptor from informations found in the P parent process descriptor. This includes the inherited ... |
81 | | 1. the process P in kernel K creates locally the main thread of process F, and register this thread in the TH_TBL(K,P), |
82 | | 1. the process P in kernel K register this new thread in the scheduler of the core executing the fork() system call, an return. |
| 78 | 1. the cluster K allocates memory in K to store the reference process descriptor of F, and get a pointer on this process descriptor using the process_alloc() function. |
| 79 | 1. the cluster K ask to kernel Z to allocate a PID for the F process, and to register the process descriptor extended pointer in PREF_TBL(Z) of cluster Z manager. This is done by the RPC_PROCESS_PID_ALLOC that takes the process descriptor pointer as argument and returns the PID. |
| 80 | 1. after RPC completion, the kernel K initializes the F process descriptor from informations found in the P parent process descriptor. This includes the inherited ... |
| 81 | 1. the kernel K creates locally the main thread of process F, and register this thread in the TH_TBL(K,P), |
| 82 | 1. the kernel K register this new thread in the scheduler of the core executing the fork() system call, an return. |
105 | | Any thread T of any process P, running in any cluster K, can create a new thread NT, on any cluster M, using the pthread_create() system call. The new thread NT will be placed on a core of the M cluster. If the M cluster does not |
106 | | contain a process descriptor copy for process P (because the NT thread is the first thread of process P in cluster M), |
107 | | a new process descriptor must be created in cluster M. |
| 105 | Any thread T of any process P, running in any cluster K, can create a new thread NT, that will execute on any core in any cluster M. This creation is driven by the pthread_create() system call. The M cluster is called the host cluster. If the M cluster does not contain a process descriptor copy for process P (because the NT thread is the first thread of process P in cluster M), a new process descriptor must be created in cluster M. |
115 | | Le noyau du cluster K connait l'identifiant du cluster Z propriétaire de P, puisque cet identifiant est contenu dans le PID. le noyau de K envoie une RPC_THREAD_USER_CREATE au cluster Z propriétaire. L'argument est une structure pthread_attr_t contenant le PID, le TRDID, la fonction à exécuter et ses arguments, et optionnellement le cluster cible et le core cible. |
116 | | Le noyau du cluster Z propriétaire de P, ne répond pas immédiatement au cluster demandeur K, mais envoie au cluster cible M une RPC_THREAD_USER_CREATE, avec les mêmes arguments. |
| 111 | The kernel K select a target cluster M, and 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 a the thread TRDID. |
120 | | Le noyau du cluster M vérifie s’il possède une copie du descripteur du processus P. |
121 | | Si ce n’est pas le cas il crée et un nouveau descripteur du processus P dans M, et alloue les structures PT(P,M), VSL(P,M), FDT(P,M), TRDL(P,M). |
122 | | Il initialise les structures VSL et FDT en utilisant des remote_memcpy() depuis le cluster Z vers le cluster M. |
123 | | La structure PT(P,M) reste vide, et se remplira à la demande lors du traitement des défauts de page. |
124 | | Quand il est sûr de posséder une copie du descripteur de processus P, il sélectionne un coeur charger d’exécuter le nouveau thread T’, Il attribue un TRDID au thread à T’, crée un descripteur de thread et l’enregistre dans la TRDL(P,M). |
125 | | Finalement, il enregistre T’ dans l’ordonnanceur du coeur sélectionné, et renvoie le TRDID dans la réponse RPC au cluster Z. |
| 115 | To execute this RPC, the kernel M will make a local copy of the pthread_attr_t structure, and execute the following steps: |
| 116 | 1. The kernel M checks if it contains a copy of the P process descriptor. |
| 117 | 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 PG_TBL(M,P), VSEG_LIST(M,P), FD_TBL(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. |
| 118 | 1. The kernel M register this new process descriptor in the COPIES_LIST and LOCAL_LIST. |
| 119 | 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. |
| 120 | 1. The kernel M registers the thread descriptor in the local process descriptor TH_TBL(M,P), and in the selected core scheduler. |
| 121 | 1. The kernel M returns the TRDID to the client cluster K, and acknowledge the RPC. |
129 | | Le noyau du cluster Z propriétaire de P alloue un descripteur de thread et l’enregistre dans sa TRDL(P,Z). |
130 | | Cette TRDL(P,Z) doit en effet contenir la totalité des descripteurs de threads du processus P. |
131 | | Puis le noyau de Z renvoie une réponse RPC au cluster K. |
132 | | |
133 | | == __5) Destruction d’un thread__ == |
134 | | |
135 | | La destruction d’un thread TRDID s’exécutant sur un cluster K est déclenchée : |
136 | | - soit par le thread lui-même (appel système pthread_exit() ), |
137 | | - soit par le noyau du cluster hôte K où s’exécute le thread, |
138 | | - soit par un signal provenant d’un autre cluster. |
139 | | Dans tous les cas, c’est le noyau du cluster hôte K, qui pilote cette destruction. |
| 125 | The destruction of a thread TRDID running in cluster K can be caused by the thread itself, with the pthread_exit() system call. It can also be caused by a signal (local or remote) requesting the thread to stop execution. In both case, the host kernel K is in charge of the destruction. |