User space

Also known as: userland

On this page 7

User space (also called userland) is the portion of a computer’s memory and execution environment in which ordinary applications, libraries and background services run without hardware privileges. Operating systems divide execution into user space and kernel space so that a faulty or malicious program cannot directly touch hardware, other processes or the kernel itself.

Among the OS fundamentals, user space is the counterpart of kernel space: code running there must ask the kernel for every privileged operation through a system call. This separation is the basis of process isolation, system stability and security on Windows, macOS, Linux and nearly every modern general-purpose platform.

How user space is enforced by the processor

User space exists because the CPU itself supports privilege levels, and the kernel configures the hardware so that user code runs at the least privileged one. On x86 processors these are protection rings, with the kernel in ring 0 and applications in ring 3; on ARM the equivalent levels are EL0 for applications and EL1 for the kernel.

Two mechanisms enforce the boundary. First, privileged instructions such as disabling interrupts, loading page tables or accessing I/O ports trigger a fault when executed in user mode. Second, the memory management unit checks a supervisor bit in every page table entry, so a user-mode access to a kernel page raises a page fault instead of succeeding.

The following table summarizes how the two execution domains differ in practice.

PropertyUser spaceKernel space
CPU privilegeLowest level (ring 3, EL0)Highest level (ring 0, EL1)
Hardware accessOnly through system callsDirect
Address spacePrivate per processShared by the whole system
Effect of a crashOne process terminatesWhole system may halt
Typical codeApplications, shells, daemonsScheduler, drivers, file systems
User space compared with kernel space

Crossing the boundary with system calls

A user-space program crosses into the kernel only through controlled entry points. The most important is the system call: the program places a call number and arguments in registers and executes a dedicated instruction such as syscall on x86-64 or svc on ARM64, which switches the CPU to kernel mode at an address the kernel chose in advance.

The kernel then validates every argument, especially pointers, because a user program could pass an address pointing into kernel memory. Data is copied between the domains with guarded routines, and the kernel returns a result or an error code before dropping back to user mode. Hardware interrupts and exceptions are the other entry paths, but they are triggered by events rather than requested by the program.

Each transition has a cost, which the next table puts into perspective.

OperationApproximate costMain factor
Ordinary function callA few nanosecondsNo mode change
Minimal system callAbout 50 to 200 nsMode switch and mitigations
vDSO call such as reading the clockTens of nanosecondsStays in user mode
Context switch between processesRoughly 1 to 10 microsecondsRegister state and cache effects
Typical cost of operations involving user space

These figures vary widely with the processor, the kernel version and active side-channel mitigations such as kernel page-table isolation, which made system calls noticeably slower on affected CPUs after 2018.

What runs in user space

Almost everything a person interacts with runs in user space, from the desktop shell to the web browser. Equally important are the system libraries that wrap system calls in convenient interfaces, such as the C library on Unix-like systems or ntdll.dll and the Win32 subsystem on Windows.

Many operating system components also live in user space by design, because a failure there is recoverable without a reboot. The table below lists common categories.

ComponentExampleRole
Init and service managersystemd, launchd, Service Control ManagerStarts and supervises services
System librariesglibc, libSystem, ntdll.dllExpose kernel services to programs
Graphical stackWindow server, compositorDraws windows and handles input
User-mode driversWindows UMDF, FUSE file systemsRun device or file system logic safely
ApplicationsBrowsers, editors, gamesPerform the user’s actual work
Common user-space components and their roles

Moving drivers into user space is a deliberate trade-off: Windows introduced the User-Mode Driver Framework and macOS replaced many kernel extensions with DriverKit system extensions so that a buggy driver crashes a process rather than the whole machine.

Memory layout of a user-space process

Every process receives its own virtual address space, and the user-space portion of it is private to that process. On 64-bit Linux and Windows, the lower half of the canonical address range, typically 128 TiB with four-level paging, belongs to user space, while the upper half maps the kernel and is inaccessible from user mode.

Inside that region, the program loader places the executable code, initialized data, the heap for dynamic allocations, memory-mapped files and shared libraries, and one stack per thread. Address space layout randomization shifts these regions at each launch so that attackers cannot predict where code resides.

  • Text segment: read-only, executable machine code of the program.
  • Data and BSS: global variables, initialized and zero-filled.
  • Heap: grows on demand through allocator requests to the kernel.
  • Stack: function frames, local variables and return addresses for each thread.

Limitations and common misconceptions

User space provides strong isolation, yet it is not a complete security boundary on its own. A process running as an administrator or root user still executes in user mode, but the kernel will honor far more of its requests, so privilege level and user permissions are separate concepts.

Several misunderstandings appear frequently, and the following table corrects them.

MisconceptionReality
Root processes run in kernel spaceThey run in user mode with broader permissions
User space means the logged-in user’s filesIt refers to CPU mode and memory, not file ownership
A user-space crash cannot affect the systemA crashed critical service can still disrupt the desktop
Kernel code is always fasterFrequent mode switches can make kernel designs slower
Frequent misconceptions about user space

Performance is the main practical limitation. Workloads dominated by many small I/O requests pay the transition cost repeatedly, which is why high-throughput networking and storage stacks sometimes use kernel-bypass frameworks or batched interfaces such as io_uring to keep work in user space.

The simple explanation

Think of a computer as a large office building. The kernel is the secured control room with the master keys, the wiring and the alarm system. User space is the general office floor where everyone does their daily work.

People on the office floor cannot walk into the control room. When they need something only the control room can do, such as opening a locked file cabinet, they submit a request at a service window. The control room checks each request and carries it out. If one worker makes a mess on the office floor, the rest of the building keeps running.

How it is used in practice

A systems administrator at a mid-sized company maintains Linux servers that mount a remote cloud storage bucket as a local folder. Instead of loading a third-party kernel module, she installs a FUSE-based file system that runs entirely in user space. Applications read and write files normally, and the kernel forwards each request to the user-space storage daemon.

One night a malformed object triggers a bug in the storage daemon and it crashes. Because the code ran in user space, only the mount point became unavailable; the web server, database and SSH sessions continued normally. The service manager restarted the daemon within five seconds, and the incident ended with a log entry rather than a full server reboot and outage.