Changes between Version 12 and Version 13 of processus_thread


Ignore:
Timestamp:
Jul 10, 2016, 7:09:12 PM (8 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v12 v13  
    7070
    7171The process creation in a remote cluster implement the POSIX fork / exec  mechanism.
    72 ALMOS-MK implements  one private scheduler per processor core.
     72Notice that ALMOS-MK implements  one private scheduler per processor core.
    7373
    7474=== 3.1) fork() ===
    7575
    76 The parent process P is running on a core in cluster K, and execute the fork() system call to create a remote process F. This syscall selects a target cluster Z, that will become the owner of the F process. Cluster K will contain the reference process descriptor. The target cluster can be specified by the user application or automatdefined by the kernel using the DQDT.
    77  1. the kernel 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.
    78  1. the kernel in cluster K ask to kernel in cluster Z to allocate a PID for the F process and to register the extended pointer on process descriptor in PREF_TBL[Z] of cluster Z. This done by the RPC_PROCESS_PID_ALLOC that takes the process descriptor pointer argument and returns the PID.
    79  1. the kernel in cluster K initializes the F process descriptor from informations found in the P parent process descriptor. This includes the inherited ...
    80  1. the kernel in cluster K creates locally the main thread of process F, and register this thread in the TH_TBL[K,P]
     76The parent process P is running on a core in cluster K, and execute the fork() system call to create a new process F on a remote cluster Z. The target cluster Z will become the owner of the F process. It is selected by the kernel using the DQDT. Cluster K will contain the reference process descriptor. The fork() sys call execute the following steps:
    8177
     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.
    8283
    83 
    84 L’appel system fork() crée dans le cluster Z un nouveau descripteur de processus pour le processus clone P’, ainsi qu’un descripteur de thread  pour le thread principal attaché au processus P’.
    85 Le descripteur du processus P’ contient en particulier la VSL(P’,Z), la PT(P’,Z), la FDT(P’,Z) qui sont des copies des tables correspondantes du processus P. En revanche la TRDL(P’,Z) ne contient que le thread nouvellement créé, ce qui signifie que le processus P’ clone est mono-thread.
    86 Puis l’appel système fork() demande au cluster cible X l’allocation d’un PID au moyen d’une TASK_FORK_RPC, en transmettant en argument l’adresse étendue du descripteur de processus P’. Cette adresse est enregistrée dans la table des processus du cluster X, et le PID est enregistré dans le descripteur du processus P’ du cluster Z.
    87 Finalement, le fork() enregistre le nouveau thread  dans l’ordonnanceur du coeur du cluster Z qui exécute le fork(), et rend la main au processus P.
    88 A la fin d'un appel système fork(), le cluster propriétaire de P' est le cluster X, et le cluster de référence de P'est le cluster Z.
     84At the end of the fork(), the owner cluster for the F process is cluster Z, and the reference cluster is K. This F process contains one single thread running on K.
    8985
    9086=== 3.2) exec() ===
    9187
    92 Une fois l'opération fork() terminée, le processus fils P’ peut exécuter l'appel système exec(). Cet appel système exec() doit remplacer le processus P' par un nouveau processus F qui exécute une nouvelle image mémoire, mais conserve le PID du processus P', et donc possède le même propriétaire que P'. Pour ce nouveau processus F, on veut que le cluster de référence soit aussi le cluster propriétaire, c'est à dire le cluster X. Pour cela, le processus P' (qui s'exécute toujours sur le cluster Z) effectue une TASK_EXEC_RPC vers le cluster X, avec les arguments suivants: le PID du processus P', le nom du fichier contenant le code binaire à charger en mémoire, les arguments de la fonction s'il y en a, les variables d'environnement.
     88After a fork() system call, the F process can execute an exec() system call. This system call forces the F process to migrate from the K cluster to the owner cluster Z, to execute a new code, while keeping the same PID. Therefore a new reference process descriptor must be created in  the Z cluster, and initialized. The Z cluster  will become both the owner and the reference cluster of the F process. The old reference process descriptor in K must be deleted.
     89The exec() system call  execute the following steps:
     90 1. The kernel K send an RPC_PROCESS_MIGRATE to cluster Z with the following arguments : the extended pointer on the F process descriptor in cluster K, the binary file, and ...
     91 1. To execute this RPC, the kernel Z allocates a new reference process descriptor in cluster Z, and initializes it from the
     92informations found in process descriptor in cluster K, using a remote_memcpy().
     93 1. The kernel Z allocates and initializes the  structures contained in the process VMM: PG_TBL(Z,F), VSEG_LIST(Z,F).
     94 1. The kernel Z creates the main thread associated to process P in cluster Z, initializes it, and register it in the TH_TBL(Z,P).
     95 1. The kernel Z registers this thread in the scheduler of the core selected by the Z kernel an acknowledges the RPC. When this thread starts execution, the binary code will be loaded in the kernel Z memory, as required by the page faults.
     96 1. When receiving the RPC acknowledge, the kernel K destroy the F process descriptor and the associated thread in cluster K, that is nor anymore involved in process F execution.
     97 This c core selected executing the fork() system call, an return.
     98
     99 from informations found in
     100le PID du processus P', le nom du fichier contenant le code binaire à charger en mémoire, les arguments de la fonction s'il y en a, les variables d'environnement.
     101
     102
    93103Cette RPC alloue dans le cluster X un descripteur de processus pour le processus F, ainsi qu’un descripteur de thread principal. Il initialise ces descripteurs et les tables PT(F,X) , VSL(F,X), TRDL(F,X) en utilisant les arguments de la RPC. Il recopie le contenu de la FDT(P’,Z) dans la FDT(F,X), en utilisant un remote_memcpy(), puisqu’il dispose de l’adresse étendue de P’.
    94104Quand le processus P’ sur le cluster Z reçoit une réponse positive pour  cette EXEC_RPC,  le processus P’ intermédiaire se termine.