I was going through the fork()
process and the steps executed mainly to get a detailed view of what is and what is not shared between the parent and the child process.
So in the dup_task_struct()
function I can clearly see that it is allocating a new stack using alloc_thread_stack_node()
(although on the same numa node as the parent), and it is then assigning it to the would be created child process task_struct
stack = alloc_thread_stack_node(tsk, node);
.
.
tsk->stack = stack;
This means that the parent and the child does not share the kernel stack..
But as I went through the man pages of fork()
, to confirm my findings, I failed to find any mention of such info.
There is a section which says the things that parent and child does not share
The child process is an exact duplicate of the parent process except for the following points:
but it does not mention the kernel stack.
Am I missing something?
Man pages in Linux Programmer's Manual describe things from the point of view of application's developers.
From that point there is only user part of the process (which runs code in user-space mode), and only those attributes are described which relates to the user process.
Description of the kernel state is out of scope of that man pages. Moreover, fork
is a part of POSIX standard, and Linux is not the only OS which implements this standard. Other OS'es may have another kernel part, which behaves differently on fork
.