Share on Facebook Share on Twitter Email
Answers.com

XNU

 
XNU kernel
Developer(s) Apple Inc.
Operating system Darwin, iPhone OS & Mac OS X
Type Kernel
License Apple Public Source License 2.0
Website http://kernel.macosforge.org/

XNU is the computer operating system kernel that Apple Inc. acquired and developed for use in the Mac OS X operating system and released as free and open source software as part of the Darwin operating system. XNU is an acronym for X is Not Unix.[1]

Originally developed by NeXT for the NeXTSTEP operating system, XNU was a hybrid kernel combining version 2.5 of the Mach kernel developed at Carnegie Mellon University with components from 4.3BSD and an object-oriented API for writing drivers called Driver Kit.

After Apple acquired NeXT, the Mach component was upgraded to 3.0, the BSD components were upgraded with code from the FreeBSD project and the Driver Kit was replaced with a C++ API for writing drivers called I/O Kit.

Contents

Kernel design

Like some other modern kernels, XNU is a hybrid, containing features of both monolithic and microkernels, attempting to make the best use of both technologies, such as the message passing capability of microkernels enabling greater modularity and larger portions of the OS to benefit from protected memory, as well as retaining the speed of monolithic kernels for certain critical tasks.

Currently, XNU runs on ARM,[2] x86, x86-64 and PowerPC based processors, both single processor and SMP models.

Mach

The core of the XNU kernel, Mach, was originally conceived as a simple microkernel. As such, it is able to run the core of an operating system as separated processes, which allows a great flexibility (one could run several operating systems in parallel above the Mach core), but this often reduced performance because of time consuming kernel/user mode context switches and overhead stemming from mapping or copying messages between the address spaces of the microkernel and that of the service daemons. With Mac OS X, the designers have attempted to streamline certain tasks and thus BSD functionalities were built into the core with Mach. The result is a combination of Mach and a classical BSD kernel, with some advantages and disadvantages of both.

Mach provides kernel threads, processes, pre-emptive multitasking, message-passing (used in inter-process communication), protected memory, virtual memory management, very soft real-time support, kernel debugging support, and console I/O.

BSD

The Berkeley Software Distribution (BSD) portion of the kernel provides the POSIX API (BSD system calls), the Unix process model atop Mach tasks, basic security policies, user and group ids, permissions, the network stack, the virtual file system code (including a filesystem independent journalling layer), several local file systems such as HFS/HFS+, 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. The BSD code present in XNU came from the FreeBSD kernel. Although much of it has been significantly modified, code sharing still occurs between Apple and the FreeBSD Project.[citation needed][dubious ]

K32/K64

XNU in Mac OS X 10.6 Snow Leopard (Darwin version 10) comes in two varieties, a 32-bit version called K32 and a 64-bit version called K64.[3] It should be noted that K32 can run 64-bit applications in userland. What's new in Mac OS X 10.6 is the ability to run XNU in 64-bit kernel space. K32 is the default kernel for 10.6 Server when used on all machines except newer Mac Pro and Xserve models (2008 and later)[4] and can run 64-bit applications. K64 has several benefits compared to K32:[5]

  • Can manage more than 32 GB RAM, as the memory map would consume an 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 GPUs, as the kernel can map all of the devices in 64-bit space even if several have very large DMA buffers.

Booting while holding down 6 and 4 will force the machine to boot K64 on machines supporting 64-bit kernels.[6] 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.

I/O Kit

I/O Kit is the device driver framework, written in a subset of C++. Using its object-oriented design, features common to any class of driver are provided within the framework itself, helping device drivers be written more quickly and using less 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 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 USB and FireWire host controllers, drivers for virtual machine software such as Parallels Desktop for Mac and VMware Fusion, and drivers for Elgato's EyeTV devices.

Protecting shared resources

In order to run safely on multiprocessor machines, access to shared resources (files, data structures etc.) must be serialized so that threads or processes do not attempt to modify the same resource at the same time. Atomic operations, spinlocks, critical sections, mutual exclusions ("mutexes"), and serializing tokens are all possible methods that can be used to prevent concurrent access. Like both Linux and FreeBSD 5, XNU, as of Mac OS X 10.4 and Darwin 8.0, employs a fine-grained mutex model to achieve higher performance on multiprocessor systems.[citation needed]

References

External links


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 
Learn More
Nouna Airport
Mac OS Forge
Nukernel

Help us answer these
In which country is Xnu spoken?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "XNU" Read more