You are previewing Mac OS X and iOS Internals: To the Apple's Core.
O'Reilly logo
Mac OS X and iOS Internals: To the Apple's Core

Book Description

An in-depth look into Mac OS X and iOS kernels

Powering Macs, iPhones, iPads and more, OS X and iOS are becoming ubiquitous. When it comes to documentation, however, much of them are shrouded in mystery. Cocoa and Carbon, the application frameworks, are neatly described, but system programmers find the rest lacking. This indispensable guide illuminates the darkest corners of those systems, starting with an architectural overview, then drilling all the way to the core.

  • Provides you with a top down view of OS X and iOS

  • Walks you through the phases of system startup—both Mac (EFi) and mobile (iBoot)

  • Explains how processes, threads, virtual memory, and filesystems are maintained

  • Covers the security architecture

  • Reviews the internal Apis used by the system—BSD and Mach

  • Dissects the kernel, XNU, into its sub components: Mach, the BSD Layer, and I/o kit, and explains each in detail

  • Explains the inner workings of device drivers

From architecture to implementation, this book is essential reading if you want to get serious about the internal workings of Mac OS X and iOS.

Table of Contents

  1. Cover
  2. Part I: For Power Users
    1. Chapter 1: Darwinism: The Evolution of OS X
      1. The Pre-Darwin Era: Mac OS Classic
      2. The Prodigal Son: NeXTSTEP
      3. Enter: OS X
      4. OS X Versions, to Date
      5. iOS — OS X Goes Mobile
      6. The Future of OS X
      7. Summary
      8. References
    2. Chapter 2: E Pluribus Unum: Architecture of OS X and iOS
      1. OS X Architectural Overview
      2. The User Experience Layer
      3. Darwin — The UNIX Core
      4. UNIX System Directories
      5. Interlude: Bundles
      6. Applications and Apps
      7. Frameworks
      8. Libraries
      9. Other Application types
      10. System Calls
      11. A High-Level View of XNU
      12. Summary
      13. References
    3. Chapter 3: On the Shoulders of Giants: OS X and iOS Technologies
      1. BSD Heirlooms
      2. OS X- and iOS-Specific Technologies
      3. OS X and iOS Security Mechanisms
      4. Summary
      5. References
    4. Chapter 4: Parts of the Process: Mach-O, Process, and Thread Internals
      1. A Nomenclature Refresher
      2. Executables
      3. Universal Binaries
      4. Dynamic Libraries
      5. Process Address Space
      6. Process Memory Allocation (User Mode)
      7. Threads
      8. References
    5. Chapter 5: Non Sequitur: Process Tracing and Debugging
      1. DTrace
      2. Other Profiling mechanisms
      3. Process Information
      4. Process and System Snapshots
      5. Kdebug
      6. Application Crashes
      7. Memory Leaks
      8. Standard UNIX Tools
      9. Using GDB
      10. Summary
      11. References and Further Reading
    6. Chapter 6: Alone in the Dark: The Boot Process: EFI and iBoot
      1. Traditional Forms of Boot
      2. EFI Demystified
      3. OS X and boot.efi
      4. iOS and iBoot
      5. Installation Images
      6. Summary
      7. References and Further Reading
    7. Chapter 7: The Alpha and the Omega — launchd
      1. launchd
      2. Lists of LaunchDaemons
      3. GUI Shells
      4. XPC (Lion and iOS)
      5. Summary
      6. References and Further Reading
  3. Part II: The Kernel
    1. Chapter 8: Some Assembly Required: Kernel Architectures
      1. Kernel Basics
      2. User Mode versus Kernel Mode
      3. Kernel/User Transition Mechanisms
      4. System Call Processing
      5. XNU and hardware abstraction
      6. Summary
      7. References
    2. Chapter 9: From the Cradle to the Grave — Kernel Boot and Panics
      1. The XNU Sources
      2. Booting XNU
      3. Boot Arguments
      4. Kernel Debugging
      5. Summary
      6. References
    3. Chapter 10: The Medium Is the Message: Mach Primitives
      1. Introducing: Mach
      2. Mach Messages
      3. IPC, in Depth
      4. Synchronization Primitives
      5. Machine Primitives
      6. Summary
      7. References
    4. Chapter 11: Tempus Fugit — Mach Scheduling
      1. Scheduling Primitives
      2. Scheduling
      3. Mach Scheduler Specifics
      4. Timer Interrupts
      5. Exceptions
      6. Summary
      7. References
    5. Chapter 12: Commit to Memory: Mach Virtual Memory
      1. Virtual Memory Architecture
      2. Physical Memory Management
      3. Mach Zones
      4. Kernel Memory Allocators
      5. Mach Pagers
      6. Paging Policy Management
      7. Summary
      8. References
    6. Chapter 13: BS”D — The BSD Layer
      1. Introducing BSD
      2. Processes and Threads
      3. Process Creation
      4. Process Control and Tracing
      5. Signals
      6. Summary
      7. References
    7. Chapter 14: Something Old, Something New: Advanced BSD Aspects
      1. Memory Management
      2. Work Queues
      3. BSD Heirlooms Revisited
      4. Apple's Policy Modules
      5. Summary
      6. References
    8. Chapter 15: Fee, FI-FO, File: File Systems and the VFS
      1. Prelude: Disk Devices and Partitions
      2. Generic File System Concepts
      3. File Systems in the Apple Ecosystem
      4. Mounting File Systems (OS X only)
      5. Disk Image Files
      6. The Virtual File System Switch
      7. FUSE — FILE SYSTEMS IN USER SPACE
      8. File I/O from Processes
      9. Summary
      10. References and Further Reading
    9. Chapter 16: To B (-Tree) or Not to Be — The HFS+ File Systems
      1. HFS+ File System Concepts
      2. HFS+ Design Concepts
      3. Components
      4. VFS and Kernel Integration
      5. Summary
      6. References
    10. Chapter 17: Adhere to Protocol: The Networking Stack
      1. User Mode Revisited
      2. Socket and Protocol Statistics
      3. Layer V: Sockets
      4. Layer III: Network Protocols
      5. Layer II: Interfaces
      6. Putting It All Together: The Stack
      7. Packet Filtering
      8. Traffic Shaping and QoS
      9. Summary
      10. References and Further Reading
    11. Chapter 18: Modu(lu)s Operandi — Kernel Extensions
      1. Extending the Kernel
      2. Kernel Extensions (Kexts)
      3. Summary
      4. References
    12. Chapter 19: Driving Force — I/O Kit
      1. Introducing I/O Kit
      2. LibKern: The I/O Kit Base Classes
      3. The I/O Registry
      4. I/O Kit from User Mode
      5. I/O Kit Kernel Drivers
      6. BSD Integration
      7. Summary
      8. References and Further Reading
  4. Appendix: Welcome to the Machine
    1. Dramatis Personae: Registers
    2. Setting: ABIs and Contexts
    3. Flow: Opcodes
    4. ARM Assembly Enhancements
    5. General Concepts
    6. References
  5. Introduction
  6. Advertisements