XNU

The XNU kernel

Developer| Apple Inc.
Written in| C, C++, assembly language
OS family| Unix-like, Unix[1]
Working state| Current
Source model| Open-source
Initial release| December 1996; 29 years ago (1996-12)
Platforms| Current: 64-bit ARM, x86-64
Historical: PowerPC (32-bit and 64-bit), IA-32, 32-bit ARM (32-bit ARM support is closed-source)
Kernel type| Hybrid
License| Apple Public Source License 2.0
Preceded by| Mach, Nukernel, NeXTSTEP kernel
Official website| github.com/apple-oss-distributions/xnu

XNU ("X is Not Unix") is the computer operating system (OS) kernel developed at Apple Inc. since December 1996 for use in the Mac OS X (now macOS) operating system and released as free and open-source software as part of the Darwin OS, which, in addition to being the basis for macOS, is also the basis for iOS, iPadOS, watchOS, visionOS, and tvOS.[2]

XNU was originally developed by NeXT for the NeXTSTEP operating system. It was a hybrid kernel derived from version 2.5 of the Mach kernel, developed at Carnegie Mellon University, which incorporated the bulk of the 4.3BSD kernel modified to run atop Mach primitives, along with an application programming interface (API) in Objective-C for writing drivers named DriverKit.[3]

After Apple acquired NeXT, the kernel was updated with code derived from OSF MK 7.3 from OSF,[4] and the FreeBSD project, and the DriverKit was replaced with new API on a restricted subset of C++[5] (based on Embedded C++)[6] named IOKit.

macOS achieved UNIX certification in 2007 with the release of Mac OS X 10.5 Leopard[7] under the Single UNIX Specification (SUS) by The Open Group.[8] Despite this, Apple retained the original 'XNU' name, which stands for 'X is Not Unix,' a relic from its NeXTSTEP origins before macOS was UNIX-certified. This has led to confusion, as the name suggests that XNU is separate from UNIX, even though macOS, as a whole, is officially recognized as a UNIX operating system.[1]

## Contents

* 1 Kernel design
* 1.1 Mach
* 1.2 BSD
* 1.3 K32/K64
* 1.4 IOKit
* 2 See also
* 3 References
* 4 External links

## Kernel design

XNU is a hybrid kernel, containing features of both monolithic kernels and microkernels.[9]

As of July 2026[update], XNU runs on ARM64 and x86-64 processors. PowerPC support was removed as of the Mac OS X Snow Leopard kernel. Support for IA-32 was removed as of the Mac OS X Lion kernel; support for 32-bit ARM was removed as of iOS 11. Support for x86-64 was removed as of the macOS Golden Gate kernel, but remains in the kernel of the current release, macOS Tahoe.

### Mach

Main article: Software:Mach (kernel)

The basis of the XNU kernel is a heavily modified (hybrid) Open Software Foundation Mach kernel (OSF MK) 7.3.[4] OSF MK 7.3 is a microkernel[10] that includes applicable code from the University of Utah Mach 4 kernel and from the many Mach 3.0 variants forked from the original Carnegie Mellon University Mach 3.0 microkernel.

XNU doesn't use Mach as a microkernel, rather including other subsystems (such as the BSD one) as a part of the kernel, instead of as a userspace daemons. Mach in XNU is used to manage virtual memory, facilitate Inter-process communication (IPC), and do Input/output (I/O) operations with the console.[11]

OSF MK 7.3 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.

Apple licensed OSF MK 7.3 from the OSF, and attempted to streamline some tasks by building BSD functions into the kernel along with the Mach code. The result is a heavily modified (hybrid) OSF MK 7.3 kernel.

### BSD

The Berkeley Software Distribution (BSD) part of the kernel provides the Portable Operating System Interface (POSIX) application programming interface (API, BSD system calls), the Unix 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 independent journaling layer), several local file systems such as Hierarchical File System (HFS, HFS Plus (HFS+)) and Apple File System (APFS), the Network File System (NFS) client and server, cryptographic framework, UNIX System V inter-process communication (IPC), audit subsystem, mandatory access control, and some of the locking primitives.[12] The BSD code present in XNU has been most recently synchronised with that from the FreeBSD kernel. Although much of it has been significantly modified, code sharing still occurs between Apple and the FreeBSD Project as of 2009[update].[13] The first thing that happens after Mach initializes BSD is the initialization of memory allocation.[14]

### K32/K64

XNU in Mac OS X Snow Leopard, v10.6, (Darwin version 10) comes in two varieties, a 32-bit version called K32 and a 64-bit version called K64.[15] K32 can run 64-bit applications in userland.[16] What was new in Mac OS X 10.6 was the ability to run XNU in 64-bit kernel space. K32 was the default kernel for 10.6 Server when used on all machines except Mac Pro and Xserve models from 2008 onwards[17] and can run 64-bit applications. K64 has several benefits compared to K32:[18]

* 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 units (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.[19] 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 (10.8) and later only provides a 64-bit kernel.

### IOKit

IOKit is the device driver framework, written in a subset of C++ based on Embedded C++ that lacks features such as exceptions, multiple inheritance, and templates.[6] Using its object-oriented design, features common to any class of driver are provided within the framework, helping device drivers be written in less time and code. IOKit is multi-threaded, symmetric multiprocessing (SMP)-safe, and allows for hot-pluggable devices and automatic, dynamic device configuration.

Many drivers can be written to run in user mode, which further enhances the stability of the system. If a driver running in user mode crashes, it will not crash the kernel. However, if a driver running in kernel mode crashes it will crash the kernel. Examples of drivers running in kernel mode include disk adapter and network adapter drivers, graphics drivers, drivers for Universal Serial Bus (USB) and FireWire host controllers, and drivers for virtual machine software such as VirtualBox, Parallels Desktop for Mac, and VMware Fusion. In macOS Catalina and later releases, DriverKit allows some of those types of drivers to run in user mode.[20]

## See also

* Kernel (operating system)
* A/UX
* mkLinux
* OSF/1
* Darwin (operating system) – open source operating system released by Apple, Inc., with XNU as kernel
* macOS – operating system released by Apple, Inc., with XNU as kernel

## References

1. ↑ 1.0 1.1 "Open Brand". https://www.opengroup.org/openbrand/register/index2.html.
2. ↑ "Porting UNIX/Linux Applications to Mac OS X: Glossary". Apple Computer. 2005. https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/glossary/glossary.html.
3. ↑ "XNU GitHub source code README". December 16, 2021. https://github.com/apple/darwin-xnu.
4. ↑ 4.0 4.1 Magee, Jim. WWDC 2000 Session 106 – Mac OS X: Kernel. 14 minutes in. Archived from the original on 2021-12-21.
5. ↑ "The libkern C++ Runtime". IOKit Device Driver Design Guidelines. https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/WritingDeviceDriver/CPluPlusRuntime/CPlusPlusRuntime.html#//apple_ref/doc/uid/TP30000695-BAJIBFDE.
6. ↑ 6.0 6.1 Amit Singh. "XNU: The Kernel". What is Mac OS X?. I/O Kit. http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html. "I/O Kit uses a restricted subset of C++"
7. ↑ "Open Brand". https://www.opengroup.org/openbrand/register/brand3555.htm.
8. ↑ McKay, Dave (2019-10-21). "Is macOS UNIX? (and What Does That Mean?)" (in en). https://www.howtogeek.com/441599/is-macos-unix-and-what-does-that-mean/.
9. ↑ "We call this kernel saunters: How Apple rearranged its XNU core with exclaves". The Register. March 8, 2025. https://www.theregister.com/security/2025/03/08/how-apple-rearranged-its-xnu-kernel-with-security-exclaves/1352740.
10. ↑ Wells, Douglas M. (1994). "A Trusted, Scalable, Real-Time Operating System Environment". 1994 IEEE Dual-Use Technologies and Applications Conference. https://pdfs.semanticscholar.org/03ac/1296f530719497b49d7580b55a2d9b8353ab.pdf.
11. ↑ Amit Singh. "XNU: The Kernel". What is Mac OS X?. Mach. http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html.
12. ↑ Watson, Robert (August 2, 2008). "Re: freebsd-advocacy Digest, Vol 248, Issue 1". freebsd-advocacy (Mailing list). Retrieved October 24, 2013.
13. ↑ "FreeBSD Quarterly Status Report (Grand Central Dispatch – FreeBSD port)". April 2009. http://www.freebsd.org/news/status/report-2009-04-2009-09.html#Grand-Central-Dispatch
FreeBSD-port.
14. ↑ Amit Singh. "XNU: The Kernel". What is Mac OS X?. BSD. http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html.
15. ↑ Mac OS X 10.6 Snow Leopard: the Ars Technica review, page 5
16. ↑ Siracusa, John (August 31, 2009). "Mac OS X 10.6 Snow Leopard: the Ars Technica review". https://arstechnica.com/apple/2009/08/mac-os-x-10-6/5/. "Finally, this is worth repeating: please keep in mind that you do not need to run the 64-bit kernel in order to run 64-bit applications or install more than 4 GB of RAM in your Mac. Applications run just fine in 64-bit mode on top of the 32-bit kernel, and even in earlier versions of Mac OS X it's been possible to install and take advantage of much more than 4GB of RAM."
17. ↑ Mac OS X Server v10.6: Macs that use the 64-bit kernel
18. ↑ "What's New in Mac OS X: Mac OS X v10.6". Apple, Inc.. https://developer.apple.com/mac/library/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html.
19. ↑ Mac OS X Server v10.6: Starting up with the 32-bit or 64-bit kernel
20. ↑ "DriverKit". https://developer.apple.com/documentation/driverkit.

## External links

* on GitHub, 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" (December 2007)

* v
* t
* e

Operating systems by Apple

Apple II, III, Lisa|

* Apple II series
* Apple DOS
* ProDOS
* GS/OS
* Apple III
* SOS
* Lisa
* Lisa OS
* MacWorks

Macintosh|

| Classic Mac OS|

* System 1
* System 2, 3, 4
* System 5
* System 6
* System 7
* Mac OS 8
* Mac OS 9

|

Mac OS X,
OS X, macOS|

* History
* NeXTSTEP
* OpenStep
* Rhapsody
* Public Beta
* Core
* Darwin
* XNU
* Desktop
* Mac OS X 10.0
* 10.1
* 10.2
* 10.3
* 10.4
* 10.5
* 10.6
* 10.7
* OS X 10.8
* 10.9
* 10.10
* 10.11
* macOS 10.12
* 10.13
* 10.14
* 10.15
* Server
* 1.0
* macOS Server

Other projects|

* Shipped
* A/ROSE
* A/UX
* AIX for Apple Network Servers
* MAE
* MkLinux
* PowerOpen Environment
* Cancelled
* Star Trek
* Taligent
* Copland
* Nukernel

iPod, iPhone, Engineering:IPad|

* iPod software
* iPhone OS
* 1
* 2
* 3
* iOS
* 4
* 5
* 6
* 7
* 8
* 9
* 10
* 11
* 12
* 13
* iPadOS

Other devices|

* Newton
* Newton OS
* Apple Watch
* watchOS
* Apple TV
* Apple TV Software
* tvOS
* HomePod
* audioOS

Italics denote discontinued products ·  List ·  Category

* v
* t
* e

Darwin-derived operating systems

History|

| Pre-Darwin|

* Unix
* BSD
* Mach
* NeXTSTEP
* OpenStep
* GNUstep
* Rhapsody

|

Macintosh|

| Mac OS X,
OS X,
macOS
(history)|

| Mac OS X
Server|

* Mac OS X Server 1.0 (Hera, Rhapsody)
* 10.0 (Cheetah)
* 10.1 (Puma)
* 10.2 (Jaguar)
* 10.3 (Panther)
* 10.4 (Tiger)
* 10.5 Leopard Server
* 10.6 Snow Leopard Server

|

* Mac OS X Public Beta (Kodiak)
* 10.0 (Cheetah)
* 10.1 (Puma)
* 10.2 (Jaguar)
* 10.3 Panther
* 10.4 Tiger
* 10.5 Leopard
* 10.6 Snow Leopard
* 10.7 Lion
* OS X 10.8 Mountain Lion
* 10.9 Mavericks
* 10.10 Yosemite
* 10.11 El Capitan
* macOS 10.12 Sierra
* 10.13 High Sierra
* 10.14 Mojave
* 10.15 Catalina

Apple TV|

| Apple TV
Software|

* Derived from Mac OS X 10.4 Tiger: 1
* 2
* 3

* Derived from iOS 4–8: 4
* 5
* 6
* 7

tvOS|

* Derived from iOS 9–13: 9
* 10
* 11
* 12
* 13

iPhone,
iPod Touch, iPad|

| iPhone OS,
iOS|

* Derived from "OS X": iPhone OS 1
* 2
* 3

* iOS 4
* 5
* 6
* 7
* 8
* 9
* 10
* 11
* 12
* 13

Apple Watch|

| watchOS|

* Derived from iOS 8–13: 1
* 2
* 3
* 4
* 5
* 6

|

HomePod|

| audioOS|

* Derived from iOS 11–13: 11
* 12
* 13

|

iPad|

| iPadOS|

* Derived from iOS 13: 13

|

Others|

* OpenDarwin
* MacPorts, DarwinPorts
* PureDarwin

* macOS version history
* Server
* iOS version history
* watchOS version history
* tvOS version history
* audioOS version history
* iPadOS version history

* v
* t
* e

Mobile operating systems

Linux
kernel|

| Mainline|

* Letux-OS
* Maemo Leste
* OpenEmbedded
* Ångström
* KaeilOS
* Openmoko Linux
* QtMoko
* SHR
* OpenEZX
* postmarketOS
* PureOS

|

Out of tree|

* AliOS
* Android
* forks
* Bada
* Firefox OS
* B2G OS
* KaiOS
* Maemo
* MeeGo
* Mer
* Sailfish OS
* Moblin
* MontaVista
* Mobilinux
* MotoMagx
* postmarketOS
* Tizen
* Ubuntu Touch
* UBports
* WebOS
* LuneOS

XNU|

* iOS
* iPadOS
* watchOS

QNX|

* BlackBerry 10
* BlackBerry Tablet OS

Windows|

* Windows XP Tablet PC Edition
* Windows Mobile
* Windows Phone
* 7
* 8
* 8.1
* Windows RT
* Windows 10 Mobile

Zircon|

* Fuchsia

Other|

* BREW
* BlackBerry OS
* EPOC
* GEOS
* Magic Cap
* Nintendo DSi
* Nintendo 3DS
* Nokia Asha platform
* PalmDOS
* Palm OS
* PlayStation
* PSP
* PS Vita
* S30
* S30+
* S40
* Symbian
* S60
* S80
* S90
* UIQ

* Comparison of mobile OSes
* Open-source mobile phones/OSes
* Open Handset Alliance
* Open Mobile Alliance
* Mobile app distributions
* Mobile app development

* v
* t
* e

macOS

* History
* Architecture
* Components
* Server
* Software

Versions|

* Server 1.0 Hera
* Public Beta Kodiak
* 10.0 Cheetah
* 10.1 Puma
* 10.2 Jaguar
* 10.3 Panther
* 10.4 Tiger
* 10.5 Leopard
* 10.6 Snow Leopard
* 10.7 Lion
* 10.8 Mountain Lion
* 10.9 Mavericks
* 10.10 Yosemite
* 10.11 El Capitan
* 10.12 Sierra
* 10.13 High Sierra
* 10.14 Mojave
* 10.15 Catalina

Applications|

* App Store
* Automator
* Calculator
* Calendar
* Chess
* Contacts
* Dictionary
* DVD Player
* FaceTime
* Finder
* Game Center
* Grapher
* Home
* iTunes (history)
* Launchpad
* Mail
* Messages
* News
* Music
* Notes
* Notification Center
* Podcasts
* Photo Booth
* Photos
* Preview
* QuickTime
* Reminders
* Safari (version history)
* Stickies
* TextEdit
* Time Machine

Discontinued|

* Dashboard
* Front Row
* iChat
* iPhoto
* iSync
* Sherlock

Utilities|

* Activity Monitor
* AirPort Utility
* AppleScript Editor
* Archive Utility
* Audio MIDI Setup
* Bluetooth File Exchange
* Boot Camp
* ColorSync
* Configurator
* Console
* Crash Reporter
* DigitalColor Meter
* Directory Utility
* DiskImageMounter
* Disk Utility
* Font Book
* Grab
* Help Viewer
* Image Capture
* Installer
* Keychain Access
* Migration Assistant
* Network Utility
* ODBC Administrator
* Screen Sharing
* System Preferences
* System Information
* Terminal
* Universal Access
* VoiceOver

Discontinued|

* Software Update
* Remote Install Mac OS X

Technology and user interface|

* AirDrop
* Apple File System
* Apple menu
* Apple Push Notification service
* AppleScript
* Aqua
* Audio Units
* AVFoundation
* Bonjour
* Bundle
* CloudKit
* Cocoa
* ColorSync
* Command key
* Core Animation
* Core Audio
* Core Data
* Core Foundation
* Core Image
* Core OpenGL
* Core Text
* Core Video
* CUPS
* Cover Flow
* Darwin
* Dock
* FileVault
* Fonts
* Gatekeeper
* Grand Central Dispatch
* icns
* iCloud
* I/O Kit
* Kernel panic
* Keychain
* launchd
* Mach-O
* Menu extra
* Metal
* Mission Control
* OpenCL
* Option key
* Preference Pane
* Property list
* Quartz
* Quick Look
* Smart Folders
* Speakable items
* Spotlight
* Stacks
* System Integrity Protection
* Uniform Type Identifier
* Universal binary
* WebKit
* XNU
* XQuartz

Deprecated|

* HFS+

Discontinued|

* BootX
* Brushed metal
* Carbon
* Classic Environment
* Inkwell
* QTKit
* Rosetta
* Spaces
* Xgrid

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/XNU. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:XNU&oldid=4569976"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template