Mac OS X(10.5) 与BSD的差别

Mac OS X的部分基于FreeBSD,尤其是在文件系统和Net Work Environment方面。然而,两者存在显著差异,如内存管理的系统调用被弃用,采用Mach-O作为主要的本地格式,不支持PEF的内存映射设备,以及在安全模型和内核扩展机制上的变化。此外,Mac OS X还引入了特定于其Darwin实现的新特性,如文件系统缓冲区缓存的增强和异步I/O。

众所周知,Mac OS X部分脱胎于BSD,特别是FreeBSD,主要是文件系统和NKE(Net Work Environment),但这二者有什么区别了,我们来看一篇文章 (2006年更新,也就是说10.5适用)。

Differences between Mac OS X and BSD

Although the BSD portion of Mac OS X is primarily derived from FreeBSD, some changes have been made:

  • The sbrk() system call for memory management is deprecated. Its use is not recommended in Mac OS X.

  • The Mac OS X runtime model uses a different object file format for executables and shared objects, and a different mechanism for executing some of those executables.

    The primary native format is Mach-O . This format is supported by the dynamic link editor ( dyld ).

    The PEF binary file format is supported by the Code Fragment Manager ( CFM).

    The kernel supports execve() with Mach-O binaries. Mapping and management of Mach-O dynamic shared libraries, as well as launching of PEF-based applications, are performed by user-space code.

  • Mac OS X does not support memory-mapped devices through the mmap() function. (Graphic device support and other subsystems provide similar functionality, but using different APIs.) In Mac OS X, this interface should be done through user clients. See the Apple I/O Kit documents for additional information.

  • The swapon() call is not supported; macx_swapon() is the equivalent call from the Mach pager.

  • The Unified Buffer Cache implementation in Mac OS X differs from that found in FreeBSD.

  • Mach provides a number of IPC primitives that are not traditionally found in UNIX. See “Boundary Crossings” for more information on Mach IPC. Some System V primitives are supported, but their use is discouraged in favor of POSIX equivalents.

  • Several changes have been made to the BSD security model to support single-user and multiple-administrator configurations, including the ability to disable ownership and permissions on a volume-by-volume basis.

  • The locking mechanism used throughout the kernel differs substantially from the mechanism used in FreeBSD.

  • The kernel extension mechanism used by Mac OS X is completely different. The Mac OS X driver layer, the I/O Kit, is an object-oriented driver stack written in C++. The general kernel programming interfaces, or KPIs, are used to write non-driver kernel extensions. These mechanisms are described more in "I/O Kit Overview" and KPI Reference , respectively.

In addition, several new features have been added that are specific to the Mac OS X (Darwin) implementation of BSD. These features are not found in FreeBSD.

  • enhancements to file-system buffer cache and file I/O clustering

    • adaptive and speculative read ahead

    • user-process controlled read ahead

    • time aging of the file-system buffer cache

  • enhancements to file-system support

    • implementation of Apple extensions for ISO-9660 file systems

    • multithreaded asynchronous I/O for NFS

    • addition of system calls to support semantics of Mac OS Extended (HFS+ ) file systems

    • additions to naming conventions for pathnames, as required for accessing multiple forks in Mac OS Extended file systems

注:Mac OS X的kernel可以说是由两部分构成:Mach(I/O kit,Driver)+BSD(filesystem,NKE)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值