Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
XNU
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Computer operating system kernel}} {{Use mdy dates|date=October 2013}} {{Not to be confused with|GNU}}{{Infobox OS | name = XNU | logo = <!-- Filename only: no wikilink, no Image: or File: --> | logo caption = | logo size = | logo alt = | screenshot = The XNU Kernel Graphic.svg | caption = The XNU kernel | screenshot_size = | screenshot_alt = | collapsible = | developer = [[Apple Inc.]] | family = [[Unix-like]], [[Unix]]<ref>https://www.opengroup.org/openbrand/register/index2.html</ref> | working state = Current | source model = [[Open-source software|Open-source]] | released = {{Start date and age|1996|12}} | latest release version = | latest release date = <!-- {{Start date and age|202y|mm|dd}} --> | latest preview version = | latest preview date = <!-- {{Start date and age|202y|mm|dd}} --> | marketing target = | programmed in = [[C (programming language)|C]], [[C++]] | update model = <!-- APT, etc. --> | package manager = <!-- dpkg, rpm, etc. --> | supported_platforms = Current: [[x86-64]], [[AArch64|64-bit ARM]], [[ARM architecture#32-bit architecture|32-bit ARM]] (32-bit ARM support is closed-source)<br />Historical: [[PowerPC]] (32-bit and 64-bit), [[IA-32]] | kernel type = [[Hybrid kernel|Hybrid]] | userland = | ui = | license = [[Apple Public Source License]] 2.0 | preceded by = [[Mach (kernel)|Mach]], [[Nukernel]] | succeeded by = | website = {{URL|github.com/apple-oss-distributions/xnu}} | other articles = }} '''XNU''' ("X is Not Unix") is the computer [[operating system]] (OS) [[Kernel (operating system)|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 (operating system)|Darwin]] OS, which, in addition to being the basis for macOS, is also the basis for [[Apple TV Software]], [[iOS]], [[iPadOS]], [[watchOS]], [[visionOS]], and [[tvOS]].<ref>{{cite web |year=2005 |url=https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/glossary/glossary.html |title=Porting UNIX/Linux Applications to Mac OS X: Glossary |publisher=Apple Computer |access-date=June 7, 2017}}</ref> 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)|Mach kernel]] developed at [[Carnegie Mellon University]], which incorporated the bulk of the [[History of the Berkeley Software Distribution#4.3BSD|4.3BSD]] kernel modified to run atop Mach primitives, along with an [[application programming interface]] (API) in [[Objective-C]] for writing drivers named DriverKit.<ref>{{cite web |url=https://github.com/apple/darwin-xnu |title=XNU GitHub source code README|website=[[GitHub]]|date=December 16, 2021}}</ref> After Apple acquired NeXT, the kernel was updated with code derived from [[OSFMK]] 7.3 from [[Open Software Foundation|OSF]],<ref name="wwdc-2000-session-106">{{cite AV media|url=https://www.youtube.com/watch?v=ggnFoDqzGMU |archive-url=https://ghostarchive.org/varchive/youtube/20211221/ggnFoDqzGMU |archive-date=2021-12-21 |url-status=live|last=Magee |first=Jim |title=WWDC 2000 Session 106 β Mac OS X: Kernel|minutes=14}}{{cbignore}}</ref> and the [[FreeBSD]] project, and the DriverKit was replaced with new API on a restricted subset of [[C++]]<ref>{{cite web|url=https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/WritingDeviceDriver/CPluPlusRuntime/CPlusPlusRuntime.html#//apple_ref/doc/uid/TP30000695-BAJIBFDE|title=The libkern C++ Runtime|work=IOKit Device Driver Design Guidelines }}</ref> (based on [[Embedded C++]])<ref>{{cite web|url=http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html|title=What is Mac OS X?|author=Amit Singh|access-date=2015-03-04|archive-date=2019-04-19|archive-url=https://web.archive.org/web/20190419152142/http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html|url-status=dead}}</ref> named IOKit. By keeping the BSD kernel into the third part of XNU,<ref>{{Cite web |date=2011-08-08 |title=How Mac OS X Works |url=https://computer.howstuffworks.com/macs/mac-os-x2.htm |access-date=2025-03-12 |website=HowStuffWorks |language=en-us}}</ref> XNU became UNIX-based when macOS achieved UNIX certification under the Single UNIX Specification (SUS) by The Open Group.<ref>{{Cite web |last=McKay |first=Dave |date=2019-10-21 |title=Is macOS UNIX? (and What Does That Mean?) |url=https://www.howtogeek.com/441599/is-macos-unix-and-what-does-that-mean/ |access-date=2025-03-12 |website=How-To Geek |language=en}}</ref> 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.<ref>{{Cite news |title=Apple macOS 15 Sequoia is officially UNIX |url=https://www.theregister.com/2024/10/11/macos_15_is_unix/ |archive-url=http://web.archive.org/web/20250124104637/https://www.theregister.com/2024/10/11/macos_15_is_unix/ |archive-date=2025-01-24 |access-date=2025-03-12 |language=en}}</ref> ==Kernel design== XNU is a [[hybrid kernel]], containing features of both [[monolithic kernel]]s and [[microkernel]]s, attempting to make the best use of both technologies, such as the [[message passing]] 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. {{As of|2021}}, XNU runs on [[ARM64]] and [[x86-64]] processors, both one processor and [[symmetric multiprocessing]] (SMP) models. [[PowerPC]] support was removed as of the version in [[Mac OS X Snow Leopard]]. Support for [[IA-32]] was removed as of the version in [[Mac OS X Lion]]; support for 32-bit ARM was removed as of the version in {{nowrap|[[iOS 11]]}}. ===Mach=== {{main|Mach (kernel)}} The basis of the XNU kernel is a heavily modified (hybrid) [[Open Software Foundation]] Mach kernel ([[OSFMK]]) 7.3.<ref name="wwdc-2000-session-106"/> OSFMK 7.3 is a microkernel<ref>{{cite conference |url=https://pdfs.semanticscholar.org/03ac/1296f530719497b49d7580b55a2d9b8353ab.pdf|archive-url=https://web.archive.org/web/20170822053715/https://pdfs.semanticscholar.org/03ac/1296f530719497b49d7580b55a2d9b8353ab.pdf|archive-date=2017-08-22|url-status=dead|title=A Trusted, Scalable, Real-Time Operating System Environment |conference=1994 IEEE Dual-Use Technologies and Applications Conference |last=Wells |first=Douglas M. |year=1994 |s2cid=5205380}}</ref> that includes applicable code from the [[University of Utah]] Mach 4 kernel and from the many Mach 3.0 variants [[Fork (software development)|forked]] from the original [[Carnegie Mellon University]] Mach 3.0 microkernel. OSFMK 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{{citation needed|date=September 2024}} 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 OSFMK 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) OSFMK 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 file system|journaling]] layer), several local file systems such as [[Hierarchical File System (Apple)|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.<ref>{{cite mailing list|url=http://lists.freebsd.org/pipermail/freebsd-advocacy/2008-August/003674.html|title=Re: freebsd-advocacy Digest, Vol 248, Issue 1|last=Watson|first=Robert|author-link=Robert Watson (computer scientist)|mailing-list=freebsd-advocacy|date=August 2, 2008|access-date=October 24, 2013}}</ref> 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|lc=y}}.<ref>{{cite web|url=http://www.freebsd.org/news/status/report-2009-04-2009-09.html#Grand-Central-Dispatch---FreeBSD-port|title=FreeBSD Quarterly Status Report (Grand Central Dispatch β FreeBSD port)|date=April 2009|access-date=October 24, 2013}}</ref> ===K32/K64=== XNU in [[Mac OS X Snow Leopard]], v10.6, ([[Darwin (operating system)|Darwin]] version 10) comes in two varieties, a [[32-bit]] version called ''K32'' and a [[64-bit computing|64-bit]] version called ''K64''.<ref>[https://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/5 Mac OS X 10.6 Snow Leopard: the Ars Technica review, page 5]</ref> K32 can run 64-bit applications in [[Userland (computing)|userland]].<ref>{{cite web|url=https://arstechnica.com/apple/2009/08/mac-os-x-10-6/5/|title=Mac OS X 10.6 Snow Leopard: the Ars Technica review|last=Siracusa |first=John |date=August 31, 2009|website=[[Ars Technica]]|quote=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.}}</ref> 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<ref>[http://support.apple.com/kb/HT3770 Mac OS X Server v10.6: Macs that use the 64-bit kernel]</ref> and can run 64-bit applications. K64 has several benefits compared to K32:<ref>{{Cite web |url=https://developer.apple.com/mac/library/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html |title=What's New in Mac OS X: Mac OS X v10.6 |website=Apple Developer |publisher=Apple, Inc.}}</ref> * 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]]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.<ref>[http://support.apple.com/kb/HT3773 Mac OS X Server v10.6: Starting up with the 32-bit or 64-bit kernel]</ref> K64 will run 32-bit applications but it will not run 32-bit [[Loadable kernel module|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++]].<ref>{{Cite web |url=http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html |work=What is Mac OS X? |title=XNU: The Kernel |at=I/O Kit |quote=I/O Kit uses a restricted subset of C++ |author=Amit Singh |access-date=September 9, 2011 |archive-date=April 19, 2019 |archive-url=https://web.archive.org/web/20190419152142/http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html |url-status=dead}}</ref> Using its [[object-oriented programming|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 space and kernel space|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 controller interface (USB, 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.<ref>{{cite web|url=https://developer.apple.com/documentation/driverkit|title=DriverKit|website=Apple Developer}}</ref> ==See also== {{Portal|Free and open-source software}} * [[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== {{Reflist}} ==External links== * {{GitHub|apple-oss-distributions/xnu}}, official repository * {{webarchive|url=https://web.archive.org/web/20200602233536/http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html|date=June 2, 2020|title=XNU: The Kernel}} β an overview of the components of XNU, written by Amit Singh in December 2003 * [https://media.ccc.de/v/24c3-2303-en-inside_the_macosx_kernel 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) {{Apple operating systems}} {{Darwin derivations}} {{Mobile operating systems}} {{macOS}} {{DEFAULTSORT:Xnu}} [[Category:iOS]] [[Category:Mach (kernel)]] [[Category:Monolithic kernels]] [[Category:MacOS]] [[Category:Software using the Apple Public Source License]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Apple operating systems
(
edit
)
Template:As of
(
edit
)
Template:Cbignore
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite AV media
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite mailing list
(
edit
)
Template:Cite news
(
edit
)
Template:Cite web
(
edit
)
Template:Darwin derivations
(
edit
)
Template:GitHub
(
edit
)
Template:Infobox OS
(
edit
)
Template:MacOS
(
edit
)
Template:Main
(
edit
)
Template:Mobile operating systems
(
edit
)
Template:Not to be confused with
(
edit
)
Template:Nowrap
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use mdy dates
(
edit
)
Template:Webarchive
(
edit
)