Changes between Version 111 and Version 112 of processus_thread


Ignore:
Timestamp:
Mar 26, 2019, 2:36:57 PM (6 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • processus_thread

    v111 v112  
    8888
    8989Regarding the process descriptor, a new PID is allocated in cluster Y.  The child process C inherits the vsegs registered in the parent process reference VSL, but the ALMOS-MKH replication policy depends on the vseg type:
    90  * for the '''DATA, MMAP, REMOTE''' vsegs (containing shared, non replicated data), all vsegs registered in the parent reference VSL(Z,P) are registered in the child  reference VSL(Y,C), and all valid GPT entries in the reference parent GPT(Z,P) are copied in the child reference GPT(Y,C). For all pages, the WRITABLE flag is reset and the COW flag is set, in both (parent and child) GPTs. This requires to update all corresponding entries in the parent GPT copies (in clusters other than the reference).
    91  * for the '''STACK''' vsegs (that are private), only one vseg is registered in the child reference VSL(Y,C). This vseg contains the user stack of the user thread requesting the fork, running in cluster X. All valid GPT entries in the parent GPT(X,P) are copied in the child GPT(Y,C). For all pages, the WRITABLE flag is reset and the COW flag is set, in both (parent and child) GPTs.
     90 * for the '''DATA, ANON, REMOTE''' vsegs (containing shared, non replicated data), all vsegs registered in the parent reference VSL(Z,P) are registered in the child  reference VSL(Y,C), and all valid GPT entries in the reference parent GPT(Z,P) are copied in the child reference GPT(Y,C). For all pages, the WRITABLE flag is reset and the COW flag is set, in both (parent and child) GPTs. This requires to update all corresponding entries in the parent GPT copies (in clusters other than the reference).
     91 * for the '''STACK''' vsegs (that are private), only one vseg is registered in the child reference VSL(Y,C). This vseg contains the user stack of the parent thread requesting the fork, running in cluster X. All valid GPT entries in the parent GPT(X,P) are copied in the child GPT(Y,C). For all pages, the WRITABLE flag is reset and the COW flag is set, in both (parent and child) GPTs.
    9292 * for the '''CODE''' vsegs (that must be replicated in all clusters containing a thread), all vsegs registered in the reference parent VSL(Z,P) are registered in the child reference VSL(Y,C), but the reference child GPT(Y,C) is not updated by the fork: It will be dynamically updated on demand in cases of page fault. 
    9393 * for the '''FILE''' vsegs (containing shared memory mapped files), all vsegs registered in the reference parent VSL(Z,P) are registered in the child reference VSL(Y,C), and all valid entries registered in the reference parent GPT(Z,P) are copied in the reference child GPT(Y,C). The COW flag is not set for these shared data.
     
    9595Regarding the thread descriptor, a new TRDID is allocated in cluster Y, and the calling parent thread context (current values stored in the CPU and FPU registers) is saved in the child thread CPU and FPU contexts, to be restored when the child thread will be selected for execution.
    9696Three CPU context slots are not simple copies of the parent value:
    97  * the '''thread pointer''' register contains the current thread descriptor address. This '''thread pointer''' register cannot have the same value for parent and child.   
     97 * the '''thread pointer''' register contains a pointer the currently running thread descriptor. This '''thread pointer''' register cannot have the same value for parent and child.   
    9898 * the '''stack pointer''' register contains the current pointer on the kernel stack. ALMOS-MKH uses a specific kernel stack when a user thread enters the kernel, and this kernel stack is implemented in the thread descriptor. As parent and child cannot use the same kernel stack, the parent kernel stack content is copied to the child kernel stack, and the '''stack pointer''' register cannot have the same value for parent and child.
    9999 * the '''page table pointer''' register contains the physical base address of the current generic page table. As the child GPT is a copy of the parent GPT in the child cluster, this '''page table register''' cannot have the same value for parent and child.
    100100
    101101At 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.
    102 All pages of DATA, REMOTE, and MMAP vsegs are marked ''Copy On Write'' in the child C process GPT (cluster Y), and in all copies of the parent P process GPT (all clusters containing a copy of P).
     102All pages of DATA, REMOTE, and ANON vsegs are marked ''Copy On Write'' in the child C process GPT (cluster Y), and in all copies of the parent P process GPT (all clusters containing a copy of P).
    103103
    104104=== 3.2) exec() ===