Have only four segments in total :
- Kernel code
- Kernel Data
- User Code
- User Data Paging used as described earlier
Kernel memory and user memory
For 64-bit architectures :
- kernel space address are the upper half of address space (≥ 0x8000 0000 0000 0000)
- user space address are 0x0 to 0x7fff ffff ffff, starting from above. kernel memory always mapped but protected against access by user processes.
Page caches
Experience shows have repeated cycles of allocation and freeing same kind of objects (eg inodes, dentries) can have pool of pages used as cache for these objects (so-called slab cache) cache maintained by application (e.g. file system)
kmalloc uses slab cache for commonly used sizes.