请输入您要查询的百科知识:

 

词条 XNU
释义

  1. Kernel design

     Mach  BSD  K32/K64  I/O Kit 

  2. Protecting shared resources

  3. See also

  4. References

  5. External links

{{Use mdy dates|date=October 2013}}{{Infobox OS
| name = XNU kernel
| logo =
| logo caption =
| logo size =
| logo alt =
| screenshot =
| caption =
| screenshot_size =
| screenshot_alt =
| collapsible =
| version of =
| developer = Apple Inc.
| family = Unix-like, Unix
| working state = Current
| source model = Open-source
| released = {{Start date and age|1996|12}}
| discontinued =
| RTM date =
| GA date =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| marketing target =
| programmed in = C, C++
| language = English, others
| update model =
| package manager =
| supported platforms = IA-32, x86-64, ARM
| kernel type = Hybrid
| userland =
| ui =
| license = Apple Public Source License 2.0
| preceded by =
| succeeded by =
| website = {{URL|opensource.apple.com/source/xnu}}
| support status =
| other articles =
}}

XNU is the computer operating system kernel developed at Apple Inc. since December 1996 for use in the macOS operating system and released as free and open-source software as part of the Darwin operating system. It is also used as the kernel for the Apple TV Software, iOS, watchOS, tvOS, and audioOS operating systems. XNU is an abbreviation of 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 Objective-C API for writing drivers called Driver Kit.{{citation needed|date=September 2014}}

After Apple acquired NeXT, the Mach component was upgraded to OSFMK 7.3 from OSF,[2] 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.{{citation needed|date=September 2014}}

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 2007, XNU runs on ARM,[3] IA-32, and x86-64 processors, both one processor and symmetric multiprocessing (SMP) models. PowerPC support is removed as of version 10 (i.e., Mac OS X 10.6).

Mach

The basis of the XNU kernel is a heavily modified (hybrid) OSFMK 7.3 kernel.[2] 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, the designers have attempted to streamline some tasks and thus BSD functionality was 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,[4] from the OSF. (OSFMK 7.3 includes applicable code from the University of Utah Mach 4 kernel and applicable code from the many Mach 3.0 variants that sprouted off from the original Carnegie Mellon University Mach 3.0 microkernel.)

BSD

The Berkeley Software Distribution (BSD) part of the kernel provides the POSIX application programming interface (API, BSD system calls), the Unix process model atop Mach tasks, basic security policies, user and group ids, permissions, the networking protocols, the virtual file system code (including a filesystem independent journaling 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.[5] 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.[6]

K32/K64

{{Update|section|reason=Does not describe any changes since 10.6|date=December 2017}}

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.[7] K32 can run 64-bit applications in userland.[8] 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[9] and can run 64-bit applications. K64 has several benefits compared to K32:[10]

  • 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.[11] 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 Mac OS X Lion, v10.7, 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++.[12] 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 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) and FireWire host controllers, and drivers for virtual machine software such as VirtualBox, Parallels Desktop for Mac, and VMware Fusion.

Protecting shared resources

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 recent versions of Linux and FreeBSD, 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|date=July 2008}}

See also

{{Portal|Free and open-source software}}
  • Kernel (operating system)
  • A/UX
  • mkLinux
  • OSF/1
  • Darwin (operating system){{snd}} open source operating system released by Apple, Inc., with XNU as kernel
  • macOS{{snd}} operating system released by Apple, Inc., with XNU as kernel

References

  • {{cite web|url=http://www.db.opengroup.org/ar/technologies/mk-dbleplus/white_paper.htm|title=MK++: A High Performance, High Assurance Microkernel|author=Keith Loepere}}
1. ^{{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 |accessdate=June 7, 2017}}
2. ^{{cite av media|url=https://www.youtube.com/watch?v=ggnFoDqzGMU|author=Jim Magee|title=WWDC 2000 Session 106 - Mac OS X: Kernel|minutes=14}}
3. ^[https://www.engadget.com/2007/07/01/iphone-processor-found-620mhz-arm/ iPhone processor found: 620MHz ARM CPU] (July 1, 2007) Retrieved January 6, 2008
4. ^{{cite web|url=https://pdfs.semanticscholar.org/03ac/1296f530719497b49d7580b55a2d9b8353ab.pdf|title=A Trusted, Scalable, Real-Time Operating System Environment|author=Douglas M. Wells}}
5. ^{{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|authorlink=Robert Watson (computer scientist)|mailinglist=freebsd-advocacy|date=August 2, 2008|accessdate=October 24, 2013}}
6. ^{{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|accessdate=October 24, 2013}}
7. ^[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]
8. ^{{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|author=John Siracusa|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 4GB 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.}}
9. ^Mac OS X Server v10.6: Macs that use the 64-bit kernel
10. ^[https://developer.apple.com/mac/library/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html What's New in Mac OS X: Mac OS X v10.6]
11. ^Mac OS X Server v10.6: Starting up with the 32-bit or 64-bit kernel
12. ^I/O Kit uses a restricted subset of C++

External links

  • Apple Open Source Browser{{snd}} XNU
  • [https://github.com/apple/darwin-xnu/ Official mirror of XNU at GitHub]
  • XNU: The Kernel{{snd}} an overview of the components of XNU, written by Amit Singh in December 2003
  • Inside the Mac OS X Kernel{{snd}} "This talk intends to clear up the confusion by presenting details of the Mac OS X kernel"
{{Mobile operating systems}}{{macOS}}{{DEFAULTSORT:Xnu}}

4 : Mach (kernel)|Monolithic kernels|MacOS|Software using the Apple Public Source License

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/14 5:38:44