User space

From Wikipedia, the free encyclopedia
  (Redirected from User mode)
Jump to: navigation, search
For the term "user space" as used in Wikipedia, see Wikipedia:User pages.
"Kernel space" redirects here. For the mathematical definition, see Null space.

A modern computer operating system usually segregates virtual memory into kernel space and user space.[a] Primarily, this separation serves to protect data and functionality from faults (by improving fault tolerance) and malicious behaviour (by providing computer security).

Kernel space[edit]

Kernel space is strictly reserved for running privileged kernel, kernel extensions, and most device drivers. In contrast, user space is the memory area where application software and some drivers execute.

Userland[edit]

The term userland (or user space) refers to all code which runs outside the operating system's kernel.[1] Userland usually refers to the various programs and libraries that the operating system uses to interact with the kernel: software that performs input/output, manipulates file system objects, application software etc.

Each user space process normally runs in its own virtual memory space, and, unless explicitly allowed, cannot access the memory of other processes. This is the basis for memory protection in today's mainstream operating systems, and a building block for privilege separation. A separate user mode can also be used to build efficient virtual machines – see Popek and Goldberg virtualization requirements. Depending on the privileges, processes can request the kernel to map part of another process's memory space to its own, as is the case for debuggers. Programs can also request shared memory regions with other processes, although other techniques are also available to allow inter-process communication.

Various layers within Linux, also showing separation between the userland and kernel space
User mode User applications For example, bash, LibreOffice, Apache OpenOffice, Blender, 0 A.D., Mozilla Firefox, etc.
Low-level system components: System daemons:
systemd, runit, logind, networkd, soundd...
Windowing system:
X11, Wayland, Mir, SurfaceFlinger (Android)
Other libraries:
GLib, GTK+, Qt, EFL, SDL, SFML, FLTK, GNUstep, etc.
Graphics:
Mesa 3D, AMD Catalyst, ...
C standard library open(), exec(), sbrk(), socket(), fopen(), calloc(), ... (up to 2000 subroutines)
glibc aims to be POSIX/SUS-compatible, uClibc targets embedded systems, bionic written for Android, etc.
Kernel mode Linux kernel stat, splice, dup, read, open, ioctl, write, mmap, close, exit, etc. (about 380 system calls)
The Linux kernel System Call Interface (SCI, aims to be POSIX/SUS-compatible)
Process scheduling
subsystem
IPC
subsystem
Memory management
subsystem
Virtual files
subsystem
Network
subsystem
Other components: ALSA, DRI, evdev, LVM, device mapper, Linux Network Scheduler, Netfilter
Linux Security Modules: SELinux, TOMOYO, AppArmor, Smack
Hardware (CPU, main memory, data storage devices, etc.)

Implementation[edit]

The most common way of implementing a user mode separate from kernel mode involves operating system protection rings.

Another approach taken in experimental operating systems is to have a single address space for all software, and rely on the programming language's virtual machine to make sure that arbitrary memory cannot be accessed – applications simply cannot acquire any references to the objects that they are not allowed to access.[2] This approach has been implemented in JXOS, Unununium as well as Microsoft's Singularity research project.

See also[edit]

Notes[edit]

  1. ^ Older operating systems, such as DOS and Windows 3.1x, do not use this architecture.

References[edit]

External links[edit]