Within the Linux kernel, knowing how memory is separated is extremely important. As knowing what programs reside where, and the requirement on the system to move memory from one place to another, can provide a huge insight into the performance, or lack of, within a system. And when it comes to the world of networking (i.e NFV), where we need to move packets through a system, having this knowledge is even more important.
Memory is divided into 2 areas, known as kernel space and user space (synonymous to the terms – kernel and user mode).
- Kernel Space – Executing code has unrestricted access to any of the memory address space and to any underlying hardware. It is reserved for the highest of trusted functions within a system. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Due to the amount of access the kernel had, any instability within the kernels executing code can result in complete system failure.
- User Space – Executing code has limited access. API calls are used to the kernel to request memory and physical hardware access. Because of the restricted access, malfunctions within user mode are limited only to the system space they are operating within.
In Layman’s terms…
Kernel space is where the kernel (i.e., the core of the operating system) runs and provides its services. Its something that the user is not allowed to interfere with.
User space is that portion of system memory in which user processes run. The irony is that even those processes are managed by the kernel. 😉
Think about the computer system as a house for a family where kernel space is the list of chores that the parents take responsibility for and user being any of the children that the parents have.
So, the children don’t interfere with what the parents do like paying the electricity bill etc but they do know that the parents will keep them in the best possible condition and they need not worry about a thing.
What the children does, like their homeworks from school comes under user space that the children themselves had to do but the parents(kernel) supervises upon and parents also put up the curfew times like the kernel makes constraints for the available resources that a user can use to perform its job.