Home > Store

Mac OS X Internals: A Systems Approach

Register your product to gain access to bonus material or receive a coupon.

Mac OS X Internals: A Systems Approach

eBook (Watermarked)

  • Your Price: $59.99
  • List Price: $74.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.


  • Copyright 2007
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-280032-2
  • ISBN-13: 978-0-13-280032-7

Mac OS X was released in March 2001, but many components, such as Mach and BSD, are considerably older. Understanding the design, implementation, and workings of Mac OS X requires examination of several technologies that differ in their age, origins, philosophies, and roles.

Mac OS X Internals: A Systems Approach is the first book that dissects the internals of the system, presenting a detailed picture that grows incrementally as you read. For example, you will learn the roles of the firmware, the bootloader, the Mach and BSD kernel components (including the process, virtual memory, IPC, and file system layers), the object-oriented I/O Kit driver framework, user libraries, and other core pieces of software. You will learn how these pieces connect and work internally, where they originated, and how they evolved. The book also covers several key areas of the Intel-based Macintosh computers.

A solid understanding of system internals is immensely useful in design, development, and debugging for programmers of various skill levels. System programmers can use the book as a reference and to construct a better picture of how the core system works. Application programmers can gain a deeper understanding of how their applications interact with the system. System administrators and power users can use the book to harness the power of the rich environment offered by Mac OS X. Finally, members of the Windows, Linux, BSD, and other Unix communities will find the book valuable in comparing and contrasting Mac OS X with their respective systems.

Mac OS X Internals focuses on the technical aspects of OS X and is so full of extremely useful information and programming examples that it will definitely become a mandatory tool for every Mac OS X programmer.

Sample Content

Table of Contents

Preface xxv

Acknowledgments xxxi

About the Author xxxiii

Chapter 1 Origins of Mac OS X 1

1.1 Apple's Quest for the Operating System 2

1.2 The NeXT Chapter 9

1.3 The Mach Factor 15

1.4 Strategies 24

1.5 Toward Mac OS X 31

Chapter 2 An Overview of Mac OS X 43

2.1 Firmware 46

2.2 Bootloader 46

2.3 Darwin 46

2.4 The xnu Kernel 48

2.5 A User-Space View of the File System 57

2.6 The Runtime Architecture 61

2.7 The C Library 74

2.8 Bundles and Frameworks 76

2.9 Core Services 89

2.10 Application Services 90

2.11 Application Environments 101

2.12 User Interface 117

2.13 Programming 121

2.14 Security 131

2.15 Mac OS X Server 145

2.16 Networking 153

Chapter 3 Inside an Apple 155

3.1 The Power Mac G5 156

3.2 The G5: Lineage and Roadmap 166

3.3 The PowerPC 970FX 174

3.4 Software Conventions 224

3.5 Examples 240

Chapter 4 The Firmware and the Bootloader 263

4.1 Introduction 263

4.2 A Whole New World 266

4.3 Power-On Reset 271

4.4 Open Firmware 272

4.5 Forth 279

4.6 The Device Tree 289

4.7 Open Firmware Interfaces 298

4.8 Programming Examples 300

4.9 Firmware Boot Sequence 324

4.10 BootX 328

4.11 Alternate Booting Scenarios 340

4.12 Firmware Security 349

4.13 Launching the Kernel 352

4.14 The BootCache Optimization 353

4.15 The Boot-Time Kernel Arguments 355

4.16 The Extensible Firmware Interface 362

Chapter 5 Kernel and User-Level Startup 381

5.1 Arranging for the Kernel to Execute 382

5.2 Low-Level Processor Initialization 388

5.3 High-Level Processor Initialization 405

5.4 Mach Subsystem Initialization 421

5.5 The First Thread 432

5.6 I/O Kit Initialization 435

5.7 BSD Initialization 443

5.8 Launching the First User-Space Program 469

5.9 Slave Processors 470

5.10 User-Level Startup 472

Chapter 6 The xnu Kernel 501

6.1 xnu Source 501

6.2 Mach 510

6.3 A Flavor of the Mach APIs 519

6.4 Entering the Kernel 529

6.5 Exception Processing 543

6.6 System Call Processing 553

6.7 System Call Categories 557

6.8 Kernel Support for Debugging, Diagnostics, and Tracing 601

6.9 Virtual Machine Monitor 659

6.10 Compiling the Kernel 676

Chapter 7 Processes 683

7.1 Processes: From Early UNIC to Mac OS X 684

7.2 Mach Abstractions, Data Structures, and APIs 687

7.3 Many Threads of a New System 726

7.4 Scheduling 774

7.5 The execve() System Call 812

7.6 Launching Applications 828

Chapter 8 Memory 835

8.1 Looking Back 835

8.2 An Overview of Mac OS X Memory Management 838

8.3 Mac VM 846

8.4 Resident Memory 868

8.5 Virtual Memory Initialization during Bootstrap 877

8.6 The Mach VM User-Space Interface 878

8.7 Using the Mach VM Interfaces 893

8.8 Kernel and User Address Space Layouts 907

8.9 Universal Page Lists (UPLs) 912

8.10 Unified Buffer Cache (UBC) 913

8.11 The Dynamic Pager Program 918

8.12 The Update Daemon 921

8.13 System Shared Memory 922

8.14 Task Working Set Detection and Maintenance 942

8.15 Memory Allocation in User Space 948

8.16 Memory Allocation in the Kernel 980

8.17 Memory-Mapped Files 1001

8.18 64-bit Computing 1005

Chapter 9 Interprocess Communication 1021

9.1 Introduction 1021

9.2 Mach IPC: An Overview 1025

9.3 Mach IPC: The Mac OS X Implementation 1041

9.4 Name and Bootstrap Servers 1060

9.5 Using Mach IPC 1080

9.6 MIG 1094

9.7 Mach Exceptions 1112

9.8 Signals 1129

9.9 Pipes 1145

9.10 Named Pipes (Fifos) 1147

9.11 File Descriptor Passing 1148

9.12 XSI IPC 1155

9.13 POSIX IPC 1156

9.14 Distributed Objects 1164

9.15 Apple Events 1172

9.16 Notifications 1181

9.17 Core Foundation IPC 1197

9.18 Synchronization 1210

Chapter 10 Extending the Kernel 1233

10.1 A Driver down the Memory Lane 1233

10.2 The I/O Kit 1235

10.3 DART 1257

10.4 Dynamically Extending the Kernel 1259

10.5 Communicating with the Kernel 1269

10.6 Creating Kernel Extensions 1271

10.7 A Programming Tour of the I/O Kit's Functionality 1288

10.8 Debugging 1321

Chapter 11 File Systems 1345

11.1 Disks and Partitions 1345

11.2 Disk Arbitration 1353

11.3 The Implementation of Disk Devices 1362

11.4 Disk Images 1366

11.5 Files and File Descriptors 1374

11.6 The VFS Layer 1376

11.7 File System Types 1386

11.8 Spotlight 1409

11.9 Access Control Lists 1441

11.10 The Kauth Authorization Subsystem 1445

Chapter 12 The HFS Plus File System 1471

12.1 Analysis Tools 1474

12.2 Fundamental Concepts 1477

12.3 The Structure of an HFS+ Volume 1491

12.4 Reserved Areas 1493

12.5 The Volume Header 1493

12.6 The HFS Wrapper 1501

12.7 Special Files 1505

12.8 Examining HFS+ Features 1531

12.9 Optimizations 1558

12.10 Miscellaneous Features 1570

12.11 Comparing Mac OS X File Systems

12.12 Comparing HFS+ and NTFS 1582

Appendix A Mac OS X on x86-Based Macintosh Computers 1587

A.1 Hardware Differences 1587

A.2 Firmware and Booting 1589

A.3 Partitioning 1590

A.4 Universal Binaries 1591

A.5 Rosetta 1592

A.6 Byte Ordering 1594

A.7 Miscellaneous Changes 1594

Index 1599


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020