Program anatomy in memory2 years ago
Each process in multitask OS works in "sandbox" in memory. This virtual address space which in the 32-bit mode represents itself 4 GB the block of addresses. These virtual addresses are put in compliance (mapping) of physical memory by tables of pages which are supported by OS kernel. Each process has the set of tables. But if we begin to use virtual addressing, it is necessary to use it for all programs working at the computer – including also a kernel. Therefore the part of space of virtual addresses needs to be reserved under a kernel.
It does not mean that the kernel uses a lot of physical memory – just at it the part of address space which can be put in compliance to necessary amount of physical memory is at the disposal. The memory space for a kernel is noted in tables of pages as exclusively used exclusive code therefore if any program tries to get in it access, there is page fault. The memory space for a kernel is present at Linux constantly, and puts in compliance the same part of physical memory at all processes. The code of a kernel and data always have addresses, and are ready to process interruptions and system calls at any time. For the user programs, on the contrary, compliance of virtual addresses of real memory changes when there is a switching of processes: