Fork a new process
What does the child process need from parent?
sched_fork: setup schduling stuff
memory: copy parent’s mm
How to share memory stuff with parent process?
Linux use COW technique to do this.
How does COW work?
Why does Linux just share page?
How to diverge the child execution flow from parent?
what is the first instruction executed by the child process?
Insepct process status
Kernel mapping: tgid_base_stuff show_map_vma
3A: Chaper 5
Check glibc sysdeps/unix/sysv/linux/x86_64/clone.S for creating a new thread.
idle kernel stack
master idle进程的kernel stack在init/init_task.c:init_thread_union
this_cpu_write(kernel_stack,(unsigned long)task_stack_page(next_p) +THREAD_SIZE);
this_cpu_write(cpu_current_top_of_stack,(unsigned long)task_stack_page(next_p) +THREAD_SIZE);
forked child not reaped by parent will hooked in process list.
if parent was killed and exit