Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What are user and kernel spaces in Linux?

Somtochukwu Uchegbu

Over time, Linux has become one of the most widely used operating systems with multiple distributions (distros), which are all unique. With all these in place, at the core of each distro we have out there, they're still composed of the same components.

The Linux OS divides the system memory into two main components, user space and kernel space. Each distro of Linux can be broken down into these two parts. They each have their individual tasks and functions, but together they bring out the uniqueness we see in our Linux machines.

This Answer explains how the user and kernel spaces work individually.

Kernel space

The kernel is known to be the heart of Linux. It is responsible for scheduling, processing, and handling file management and system security. The kernel also supports user programs and the user space.

The kernel is provided with a shield around it, where it can execute the kernel code safely. This shield is known as the kernel space. The kernel has access to all the system resources, including hardware (Memory, I/O, Network, and so on) without restrictions, to perform certain tasks, and to keep the systems running at optimal capacity.

The kernel space, being one of the components of the system memory, is used to protect and isolate the kernel activities from the user space. It is known to be the area where the kernel operations are carried out, which helps keep the system running at an optimum capacity.

User space

The user space is an allocated memory location where the user processes or user programs run. The kernel manages the user space, so as not to allow processes to interfere with each other.

Processes running under the user space have limited virtual memory allocated to them, while programs running in the kernel have access to all the systems memory. These user space processes include application software, GUI, the Shell, and more.

The user space can interact with the kernel space through system calls:

System calls

A system call, commonly known as sys calls, is a program that allows another program to request services from the kernel of an OS, which the other program depends on by runtime.

For example, if we write a complex program that needs to access any of our drivers, we do not have access to that driver under normal circumstances. First, we need to send a system call (a request) to the kernel to access that particular driver our program needs to run.



View all Courses

Keep Exploring