XNU is the computer
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
(OS)
kernel developed at
Apple Inc.
Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company b ...
since December 1996 for use in the Mac OS X (now
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
) operating system and released as
free and open-source software
Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
as part of the
Darwin OS, which in addition to macOS is also the basis for the
Apple TV Software
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus ''Malus''. The tree originated in Central Asia, where its wild ancestor, ' ...
,
iOS
iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company's mobile devices, including the iPhone; the term also includes ...
,
iPadOS,
watchOS, and
tvOS OSes. ''XNU'' is an abbreviation of ''X is Not
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
''.
Originally developed by
NeXT
Next may refer to:
Arts and entertainment Film
* ''Next'' (1990 film), an animated short about William Shakespeare
* ''Next'' (2007 film), a sci-fi film starring Nicolas Cage
* '' Next: A Primer on Urban Painting'', a 2005 documentary film
Lit ...
for the
NeXTSTEP
NeXTSTEP is a discontinued object-oriented, multitasking operating system based on the Mach kernel and the UNIX-derived BSD. It was developed by NeXT Computer in the late 1980s and early 1990s and was initially used for its range of proprieta ...
operating system, XNU was a
hybrid kernel derived from version 2.5 of the
Mach kernel developed at
Carnegie Mellon University
Carnegie Mellon University (CMU) is a private research university in Pittsburgh, Pennsylvania. One of its predecessors was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools; it became the Carnegie Institute of Technology ...
, which incorporated the bulk of the
4.3BSD The History of the Berkeley Software Distribution begins in the 1970s.
1BSD (PDP-11)
The earliest distributions of Unix from Bell Labs in the 1970s included the source code to the operating system, allowing researchers at universities to modify an ...
kernel modified to run atop Mach primitives, along with an
application programming interface
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how t ...
(API) in
Objective-C for writing drivers named Driver Kit.
After Apple acquired NeXT, the kernel was updated with code derived from
OSFMK 7.3 from
OSF,
and the
FreeBSD
FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
project, and the Driver Kit was replaced with a
C++ API for writing drivers named I/O Kit.
Kernel design
XNU is a
hybrid kernel, containing features of both
monolithic kernels and
microkernels, attempting to make the best use of both technologies, such as the
message passing
In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting i ...
ability of microkernels enabling greater modularity and larger portions of the OS to benefit from
memory protection, and retaining the speed of monolithic kernels for some critical tasks.
, XNU runs on
ARM64 and
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit version of the x86 instruction set, first released in 1999. It introduced two new modes of operation, 64-bit mode and compatibility mode, along with a new 4-level paging mod ...
processors, both one processor and
symmetric multiprocessing
Symmetric multiprocessing or shared-memory multiprocessing (SMP) involves a multiprocessor computer hardware and software architecture where two or more identical processors are connected to a single, shared main memory, have full access to all ...
(SMP) models.
PowerPC
PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
support was removed as of the version in
Mac OS X 10.6
Mac OS X Snow Leopard (version 10.6) is the seventh major release of macOS, Apple's desktop and server operating system for Macintosh computers.
Snow Leopard was publicly unveiled on June 8, 2009 at Apple’s Worldwide Developers Conference. ...
. Support for
IA-32
IA-32 (short for "Intel Architecture, 32-bit", commonly called i386) is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the 80386 microprocessor in 1985. IA-32 is the first incarnation of ...
was removed as of the version in
Mac OS X 10.7; support for 32-bit ARM was removed as of the version in .
Mach
The basis of the XNU kernel is a heavily modified (hybrid)
Open Software Foundation Mach kernel (
OSFMK) 7.3.
As such, it is able to run the core of an operating system as separated processes, which allows a great flexibility (it could run several operating systems in parallel above the Mach core), but this often reduces performance because of time-consuming kernel/user mode context switches and overhead stemming from mapping or copying messages between the address spaces of the kernel and that of the service daemons. With
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
, the designers have attempted to streamline some tasks and thus
BSD
The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
functions were built into the core with Mach. The result is a heavily modified (hybrid) OSFMK 7.3 kernel, Apple licensed OSFMK 7.3, which is a microkernel, from the OSF. OSFMK 7.3 includes applicable code from the
University of Utah
The University of Utah (U of U, UofU, or simply The U) is a public research university in Salt Lake City, Utah. It is the flagship institution of the Utah System of Higher Education. The university was established in 1850 as the University of De ...
Mach 4 kernel and from the many Mach 3.0 variants
forked from the original
Carnegie Mellon University
Carnegie Mellon University (CMU) is a private research university in Pittsburgh, Pennsylvania. One of its predecessors was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools; it became the Carnegie Institute of Technology ...
Mach 3.0 microkernel.
BSD
The
Berkeley Software Distribution
The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
(BSD) part of the kernel provides the Portable Operating System Interface (
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
)
application programming interface
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how t ...
(API, BSD system calls), the
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
process model atop Mach tasks, basic security policies, user and group ids, permissions, the network
protocol stack (protocols), the
virtual file system code (including a
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
independent
journaling layer), several local file systems such as
Hierarchical File System (HFS,
HFS Plus (HFS+)) and
Apple File System
Apple File System (APFS) is a Proprietary software, proprietary file system developed and deployed by Apple Inc. for macOS macOS Sierra, Sierra (10.12.4) and later, iOS iOS 10 , 10.3 and later, tvOS 10.2 and later, watchOS 3.2 and later, and ...
(APFS), the
Network File System (NFS) client and server, cryptographic framework,
UNIX System V
Unix System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, numbered 1, 2, 3, an ...
inter-process communication
In computer science, inter-process communication or interprocess communication (IPC) refers specifically to the mechanisms an operating system provides to allow the processes to manage shared data. Typically, applications can use IPC, categori ...
(IPC), audit subsystem,
mandatory access control, and some of the locking primitives. The BSD code present in XNU has been most recently synchronised with that from the
FreeBSD
FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
kernel. Although much of it has been significantly modified, code sharing still occurs between Apple and the FreeBSD Project .
K32/K64
XNU in
Mac OS X Snow Leopard, v10.6, (
Darwin version 10) comes in two varieties, a
32-bit
In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32-bit units. Compared to smaller bit widths, 32-bit computers can perform large calculation ...
version called ''K32'' and a
64-bit
In computer architecture, 64-bit Integer (computer science), integers, memory addresses, or other Data (computing), data units are those that are 64 bits wide. Also, 64-bit central processing unit, CPUs and arithmetic logic unit, ALUs are those ...
version called ''K64''. K32 can run 64-bit applications in
userland. What was new in Mac OS X 10.6 was the ability to run XNU in 64-bit
kernel space
A modern computer operating system usually segregates virtual memory into user space and kernel space. Primarily, this separation serves to provide memory protection and hardware protection from malicious or errant software behaviour.
Kernel ...
. K32 was the default kernel for 10.6 ''Server'' when used on all machines except
Mac Pro
Mac Pro is a series of workstations and servers for professionals that are designed, developed and marketed by Apple Inc. since 2006. The Mac Pro, by some performance benchmarks, is the most powerful computer that Apple offers. It is one of f ...
and
Xserve
Xserve is a line of rack unit computers designed by Apple Inc. for use as servers. Introduced in 2002, it was Apple's first designated server hardware design since the Apple Network Server in 1996. In the meantime, ordinary Power Macintosh G3 a ...
models from 2008 onwards and can run 64-bit applications. K64 has several benefits compared to K32:
* Can manage more than 32 GB RAM, as the memory map would consume a disproportionately large area of the 32-bit kernel space.
* Cache buffer sizes can be larger than what the 32-bit kernel space allows, potentially increasing I/O performance.
* Performance is increased when using high-performance networking devices or multiple
graphics processing unit
A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobi ...
s (GPUs), as the kernel can map all of the devices in 64-bit space even if several have very large
direct memory access (DMA) buffers.
Booting while holding down ''6'' and ''4'' forces the machine to boot K64 on machines supporting 64-bit kernels. K64 will run 32-bit applications but it will not run 32-bit
kernel extensions (KEXTs), so these must be ported to K64 to be able to load.
XNU in
OS X Mountain Lion
OS X Mountain Lion (version 10.8) is the ninth major release of macOS, Apple Inc.'s desktop and server operating system for Macintosh computers. OS X Mountain Lion was released on July 25, 2012, for purchase and download through Apple's Mac Ap ...
, v10.8, and later only provides a 64-bit kernel.
I/O Kit
I/O Kit is the
device driver
In computing, 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, enabling operating systems and ot ...
framework, written in a subset of
C++ based on
Embedded C++.
I/O Kit uses a restricted subset of C++
/ref> Using its object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
design, features common to any class of driver are provided within the framework, helping device drivers be written in less time and code. The I/O Kit is multi-threaded, symmetric multiprocessing
Symmetric multiprocessing or shared-memory multiprocessing (SMP) involves a multiprocessor computer hardware and software architecture where two or more identical processors are connected to a single, shared main memory, have full access to all ...
(SMP)-safe, and allows for hot-pluggable devices and automatic, dynamic device configuration.
Many drivers can be written to run from user space, which further enhances the stability of the system. If a user-space driver crashes, it will not crash the kernel. However, if a kernel-space driver crashes it will crash the kernel. Examples of kernel-space drivers include disk adapter and network adapter drivers, graphics drivers, drivers for Universal Serial Bus (USB
Universal Serial Bus (USB) is an industry standard that establishes specifications for cables, connectors and protocols for connection, communication and power supply (interfacing) between computers, peripherals and other computers. A broad v ...
) and FireWire
IEEE 1394 is an interface standard for a serial bus for high-speed communications and isochronous real-time data transfer. It was developed in the late 1980s and early 1990s by Apple in cooperation with a number of companies, primarily Sony an ...
host controllers, and drivers for virtual machine
In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
software such as VirtualBox
Oracle VM VirtualBox (formerly Sun VirtualBox, Sun xVM VirtualBox and Innotek VirtualBox) is a type-2 hypervisor for x86 virtualization developed by Oracle Corporation.
VirtualBox was originally created by Innotek GmbH, which was acquired by ...
, Parallels Desktop for Mac
Parallels Desktop for Mac is software providing hardware virtualization for Macintosh computers with Intel processors, and since version 16.5 also for Apple silicon-based Macintosh computers. It is developed by Parallels, since 2018 a subsidiary ...
, and VMware Fusion
VMware Fusion is a software hypervisor developed by VMware for Mac computers. VMware Fusion allows Macs with Intel or the Apple M series of chips to run virtual machines with guest operating systems, such as Microsoft Windows, Linux, or macOS, ...
.
See also
* Kernel (operating system)
The kernel is a computer program at the core of a computer's operating system and generally has complete control over everything in the system. It is the portion of the operating system code that is always resident in memory and facilitates in ...
* A/UX
A/UX is Apple Computer's Unix-based operating system for Macintosh computers, integrated with System 7's graphical interface and application compatibility. Launched in 1988 and discontinued in 1995 with version 3.1.1, it is Apple's first official ...
* mkLinux
MkLinux (for Microkernel Linux) is an open-source software computer operating system begun by the Open Software Foundation Research Institute and Apple Computer in February 1996, to port Linux to the PowerPC platform, and Macintosh computers. The ...
* OSF/1
OSF/1 is a variant of the Unix operating system developed by the Open Software Foundation during the late 1980s and early 1990s. OSF/1 is one of the first operating systems to have used the Mach kernel developed at Carnegie Mellon University, and ...
* Darwin (operating system) – open source operating system released by Apple, Inc., with XNU as kernel
* macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
– operating system released by Apple, Inc., with XNU as kernel
References
*
External links
* , official repository
* – an overview of the components of XNU, written by Amit Singh in December 2003
Inside the Mac OS X Kernel
– "This talk intends to clear up the confusion by presenting details of the Mac OS X kernel"
{{DEFAULTSORT:Xnu
iOS
Mach (kernel)
Monolithic kernels
MacOS
Software using the Apple Public Source License