Changes between Version 27 and Version 28 of processus_thread


Ignore:
Timestamp:
Jul 20, 2016, 12:13:51 PM (8 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v27 v28  
    7272== __3) Process creation__ ==
    7373
    74 The process creation in a remote cluster implement the POSIX fork / exec  mechanism.
     74The process creation in a remote cluster implement the POSIX fork() / exec()  mechanism.
    7575When a parent process P executes the fork() system call, a new child process C is created.
    76 The new F process inherit from the parent process P the open files (FD_TBL), and the memory image (VSEG_LIST and PG_TBL), and the corresponding structures must be replicated in the new process descriptor. After a fork(), the C process can execute an exec() system call, that allocate a new memory image to the C process, but the new process can also continue to execute with the inherited memory image. For load balancing, ALMOS-MK  uses the DQDT to create the child process C on a different cluster from the parent cluster P.
    77 Therefore, P and C have usually different owner clusters.
     76The new C process inherit from the parent process P the open files (FD_TBL), and the memory image (VSEG_LIST and PG_TBL). These structures must be replicated in the new process descriptor. After a fork(), the C process can execute an exec() system call, that allocate a new memory image to the C process, but the new process can also continue to execute with the inherited memory image. For load balancing, ALMOS-MK  uses the DQDT to create the child process C on a different cluster from the parent cluster P, but the user application can also use the fork_place() system call to specify the target cluster.
    7877
    7978=== 3.1) fork() ===
    8079
    81 The parent process P is running on a core in cluster K, and executes the fork() system call to create a new process C on a remote cluster Z that will  become the owner of the C process. ALMOS-MK creates the first C process descriptor in the same cluster as the parent cluster P, and postpone the costly copy of page table 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 the target cluster later, when the child process makes an "exec" or any other system call.
     80The parent process P is running on a core in cluster K, and executes the fork() system call to create a new process C on a remote cluster Z that will  become the owner of 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 page table 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 the target cluster later, when the child process makes an "exec" or any other system call.
    8281
    83  1. the cluster K allocates memory in K for the reference process descriptor of c, and get a pointer on this process descriptor using the process_alloc() function.
     82 1. the cluster K allocates memory in K for the reference process descriptor of C, and get a pointer on this process descriptor.
    8483 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 its PREF_TBL(Z). It uses the RPC_PROCESS_PID_ALLOC that takes the process descriptor pointer as argument and returns the PID.
    85  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 ...
    86  1. the kernel K creates locally the main thread of process F, and register this thread in the TH_TBL(K,P),
     84 1. after RPC completion, the kernel K initializes the C process descriptor from informations found in the P parent process descriptor. This includes the inherited ...
     85 1. the kernel K creates locally the main thread of process C, and register this thread in the TH_TBL(K,P),
    8786 1. the kernel K register this new thread in the scheduler of the core executing the fork() system call, an return.
    8887
    89 At 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.
     88At 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.
    9089
    9190=== 3.2) exec() ===
    9291
    93 After 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.
    94 The exec() system call  executes the following steps:
     92After 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 application, while keeping the same PID. Therefore a new reference process descriptor , and the associated main thread are created in  the Z cluster, and initialized from values found in the .elf file defining the new application. The Z cluster  becomes both the owner and the reference cluster of the F process. The old reference process descriptor and the associated thread in K are deleted.
     93
    9594 1. The kernel K send an RPC_PROCESS_MIGRATE to cluster Z. The argument are the extended pointer on the F process descriptor in cluster K.
    9695 1. To execute this RPC, the kernel Z allocates a new reference process descriptor in cluster Z, and initializes it from informations found in process descriptor in cluster K, using a remote_memcpy().
    97  1. The kernel Z allocates and initializes the  structures contained in the process VMM: PG_TBL(Z,F), VSEG_LIST(Z,F).
     96 1. The kernel Z allocates and initializes from disk the  structures contained in the process VMM: PG_TBL(Z,C), VSEG_LIST(Z,C).
    9897 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).
    9998 1. The kernel Z registers this thread in the scheduler of the core selected by the Z kernel and acknowledges the RPC.
     
    101100
    102101At the end of the exec() system call, the cluster Z is both the owner and the reference cluster for process F, that contains one single thread in cluster Z.
     102
     1033.3) No exec()
     104
     105If the new C process does not execute the exec() system call, but executes another system call, the C process migrate from K to Z,
     106as in previous section, but the structures contained in the VMM (PG_TBL(Z,C) and VSEG_LIST(Z,C) are replicated from the values contained in process P, using a remote memcopy().
    103107
    104108== __4) Thread creation__ ==