XNU
Developer | Apple Inc. |
---|---|
Written in | C, C++ |
OS family | Unix-like, Unix |
Working state | Current |
Source model | Open-source |
Initial release | December 1996 |
Repository | |
Platforms | Current: |
Kernel type | Hybrid |
License | Apple Public Source License 2.0 |
Preceded by | Mach, Nukernel |
Official website | github |
XNU ("X is Not Unix") is the computer
XNU was originally developed by
After Apple acquired NeXT, the kernel was updated with code derived from
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 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[update], XNU runs on
Mach
The basis of the XNU kernel is a heavily modified (hybrid)
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 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
The
K32/K64
XNU in
- 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.[13] 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.
I/O Kit
I/O Kit is the device driver framework, written in a subset of C++ based on Embedded C++.[14] 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. The I/O Kit 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 from
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
- ^ "Porting UNIX/Linux Applications to Mac OS X: Glossary". Apple Computer. 2005. Retrieved June 7, 2017.
- ^ "XNU GitHub source code README". GitHub. December 16, 2021.
- ^ a b Magee, Jim. WWDC 2000 Session 106 – Mac OS X: Kernel. 14 minutes in. Archived from the original on December 21, 2021.
- ^ "The libkern C++ Runtime". IOKit Device Driver Design Guidelines.
- ^ Amit Singh. "What is Mac OS X?". Archived from the original on April 19, 2019. Retrieved March 4, 2015.
- S2CID 5205380. Archived from the original(PDF) on August 22, 2017.
- ^ Watson, Robert (August 2, 2008). "Re: freebsd-advocacy Digest, Vol 248, Issue 1". freebsd-advocacy (Mailing list). Retrieved October 24, 2013.
- ^ "FreeBSD Quarterly Status Report (Grand Central Dispatch – FreeBSD port)". April 2009. Retrieved October 24, 2013.
- ^ Mac OS X 10.6 Snow Leopard: the Ars Technica review, page 5
- ^ Siracusa, John (August 31, 2009). "Mac OS X 10.6 Snow Leopard: the Ars Technica review". Ars Technica.
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.
- ^ Mac OS X Server v10.6: Macs that use the 64-bit kernel
- ^ "What's New in Mac OS X: Mac OS X v10.6". Apple Developer. Apple, Inc.
- ^ Mac OS X Server v10.6: Starting up with the 32-bit or 64-bit kernel
- ^ Amit Singh. "XNU: The Kernel". What is Mac OS X?. I/O Kit. Archived from the original on April 19, 2019. Retrieved September 9, 2011.
I/O Kit uses a restricted subset of C++
External links
- xnu on GitHub, official repository
- XNU: The Kernel at the Wayback Machine (archived June 2, 2020) – 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)