Hi I am new to Linux Kernel Development. So want some clearity for the following statement.
*> In memory, every process is given a 4GB of virtual address space
considering a 32-bit architecture. The lower 3GB virtual addresses is accessible to the user space portion of the process and the upper 1GB is accessible to the kernel space portion.*
- Does it mean that each process in linux is allocated that much memory space 1GB+3GB?
- If yes then there are hundreds of process in linux , so 100*4GB space from where the system gets so much of memory space?
- What it has relation with the kernel stack and user stack ?
- Does every process in linux has kernel and user stack ?
No. All processes share the same kernel space. In addition, these are the maximum theoretical limits. They can be further restricted by system settings, process settings, and the size of the page file. Even if a system allowed a process to grow to the maximum side, processes generally start small and have to grow to reach the maximum.
See above. If allowed, such memory space would be on disk in the page file (partition).
They are separate stacks. The kernel stack is located in the kernel space and the user stack is in the user space. The processor uses the kernel stack when executing in kernel mode and the user stack while in user mode. The switch is automatic as part of hardware switch between modes.
Yes. There is one for each thread. Kernel stacks tend to be small.