A modern computer
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
usually uses
virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides
memory protection and hardware protection from malicious or errant software behaviour.
Kernel space is strictly reserved for running a privileged
operating system kernel, kernel extensions, and most
device driver
In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s. In contrast, user space is the memory area where
application software
Application software is any computer program that is intended for end-user use not operating, administering or programming the computer. An application (app, application program, software application) is any program that can be categorized as ...
and some drivers execute, typically with one address space per process.
Overview
The term user space (or userland) refers to all code that runs outside the operating system's kernel. User space usually refers to the various programs and
libraries
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
that the operating system uses to interact with the kernel: software that performs
input/output
In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
, manipulates
file system objects,
application software
Application software is any computer program that is intended for end-user use not operating, administering or programming the computer. An application (app, application program, software application) is any program that can be categorized as ...
, etc.
Each user space
process
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
* Business process, activities that produce a specific s ...
usually runs in its own
virtual memory
In computing, virtual memory, or virtual storage, is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a ver ...
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
Privilege may refer to:
Arts and entertainment
* Privilege (film), ''Privilege'' (film), a 1967 film directed by Peter Watkins
* Privilege (Ivor Cutler album), ''Privilege'' (Ivor Cutler album), 1983
* Privilege (Television Personalities album ...
. A separate user mode can also be used to build efficient virtual machines – see
Popek and Goldberg's virtualization requirements. With enough privileges, processes can request the kernel to map part of another process's memory space to their own, as is the case for
debugger
A debugger is a computer program used to test and debug other programs (the "target" programs). Common features of debuggers include the ability to run or halt the target program using breakpoints, step through code line by line, and display ...
s. Programs can also request
shared memory regions with other processes, although other techniques are also available to allow
inter-process communication
In computer science, interprocess communication (IPC) is the sharing of data between running Process (computing), processes in a computer system. Mechanisms for IPC may be provided by an operating system. Applications which use IPC are often cat ...
.
Implementation
The most common way of implementing a user mode separate from
kernel mode involves operating system
protection ring
In computer science, hierarchical protection domains, often called protection rings, are mechanisms to protect data and functionality from faults (by improving fault tolerance) and malicious behavior (by providing computer security).
Computer ...
s.
Protection rings, in turn, are implemented using
CPU modes
CPU modes (also called processor modes, CPU states, CPU privilege levels and other names) are operating modes for the central processing unit of most computer architectures that place restrictions on the type and scope of operations that can be ...
.
Typically, kernel space programs run in
kernel mode, also called
supervisor mode;
standard applications in user space run in user mode.
Some operating systems are
single address space operating systems—with a single address space for all user-mode code. (The kernel-mode code may be in the same address space, or it may be in a second address space).
Other operating systems have a per-process address space, with a separate address space for each user-mode process.
Another approach taken in experimental operating systems is to have a single
address space
In computing, an address space defines a range of discrete addresses, each of which may correspond to a network host, peripheral device, disk sector, a memory cell or other logical or physical entity.
For software programs to save and retrieve ...
for all software, and rely on a programming language's semantics to ensure that arbitrary memory cannot be accessed – applications cannot acquire any
reference
A reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''nam ...
s to the objects that they are not allowed to access.
This approach has been implemented in
JXOS, Unununium and Microsoft's
Singularity research project.
See also
*
BIOS
In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is a type of firmware used to provide runtime services for operating systems and programs and to perform hardware initialization d ...
*
CPU modes
CPU modes (also called processor modes, CPU states, CPU privilege levels and other names) are operating modes for the central processing unit of most computer architectures that place restrictions on the type and scope of operations that can be ...
*
Early user space
*
Memory protection
*
OS-level virtualization
Notes
References
External links
Linux Kernel Space Definition*
{{DEFAULTSORT:User Space
Operating system technology
Device drivers