I am a bit confused in user space and kernel space . Is kernel space included in the 4 gb virtual memory of a.out in linux or kernel space is different and not included in that 4 gb memory space . Also the part of 4 gb virtual memory which is reserved for operating system includes kernel or kernel space . Please do correct me if all the above concepts of me are wrong
Share
It’s all up to the OS.
Most operating systems divide the space in 4GB like 2/2 or 3/1 because it makes it easier to switch from user mode to kernel mode, page tables are not needed to be remapped during the switch.
However, Linux even allows 4GB user space and 4GB kernel space. But as you can imagine this requires remapping the complete memory everytime you need to switch to kernel mode, which incurs some overhead.
Although it’s in your memory space, OS does not allow the kernel space to be accessed from user mode code. This kind of access control is possible because of the privilege bits in the page table.
All calls to kernel from user space is actually an
int 80hcall. This call transfers the call to kernel’s interrupt handler and makes both kernel and user space accessible.