Architecture, Kernel and Systems Programming on Apple’s Operating System
Introduction
Chapter 1: The Darwin Foundation
- From NeXTSTEP to macOS: A Brief History
- The Darwin Architecture: Layers and Abstractions
- What Is Open Source, What Is Proprietary
- macOS vs Linux vs Windows: Architectural Comparison
- Setting Up Your Research Environment
Chapter 2: The XNU Kernel
- XNU: “X is Not Unix”: Design Philosophy
- The Mach Microkernel Subsystem
- The BSD Subsystem: POSIX Compliance and Extensions
- The I/O Kit Object-Oriented Driver Framework
- Kernel Initialization and Early Boot Sequence
Chapter 3: Processes, Threads and Scheduling
- Mach Tasks: The Resource Container Abstraction
- BSD Processes and the proc Structure
- Thread Management: Kernel Threads, User Threads and Work Queues
- The Scheduling Algorithm: Fair Share, Priority Inheritance and Energy Awareness
- Process Creation, Termination and the execve Flow
Chapter 4: Virtual Memory and Memory Layout
- Page Tables and the ARM64 TTBR Architecture
- Physical Memory Management: Pages, Zones and Plists
- The Virtual Memory Map: Stack, Heap, Mappings and the Shared Region
- ASLR, Guard Pages and Memory Protection Schemes
- Compressed Memory (zram) and Memory Pressure
Chapter 5: Mach IPC: Interprocess Communication
- Port Rights: Send, Receive and Make-Receive
- Message Structure and Wire Format
- The msg_trap Mechanism and Kernel Message Handling
- Dead Name Notifications and Port Lifecycle
- Practical Mach IPC Example: Sender and Receiver
- Higher-Level IPC: XPC, Distributed Objects and CoreFoundation Bridges
Chapter 6: Synchronization and Concurrency Primitives
- Lock Types: Spinlocks, Mutexes, RW Locks and LCK Variants
- Semaphores: Mach vs BSD vs libdispatch
- Condition Variables and Futex-Like Mechanisms
- Atomic Operations on ARM64 and Apple Silicon
- Grand Central Dispatch: The User-Space Concurrency Engine
Chapter 7: Storage: APFS, CoreStorage and the I/O Stack
- The Disk Arbitration Stack and Block Device Drivers
- APFS Internal Structure: Containers, Volumes and Allocation Groups
- Copy-on-Write, Clones and Hard Links in APFS
- Snapshots, Journaling and Crash Consistency
- FileVault Encryption and the Secure Enclave Integration
Chapter 8: Networking Stack
- The BSD Socket Layer and Protocol Family Abstraction
- IP Stack: IPv4/IPv6, Routing and NAT
- TCP/IP Implementation Details in XNU
- Network Interfaces: Hardware, Software and Virtual Adapters
- Network Extensions (NE) and the Modern Networking Framework
Chapter 9: Executable Formats: Mach-O, Linking and Loading
- Mach-O File Format: Headers, Load Commands and Sections
- The Dynamic Linker (dyld): Initialization Sequence
- The Shared Cache: Prebinding System Libraries for Speed
- Code Signing Verification in the Loading Pipeline
- Runtime Dylib Resolution and Interposing
Chapter 10: Apple Silicon Architecture and Kernel Adaptations
- Apple Silicon SoC: CPU Clusters, GPU, Neural Engine and I/O
- ARM64 Exception Model and Kernel Entry Paths
- Pointer Authentication Codes (PAC) in XNU
- Unified Memory Architecture and Cross-Device Memory Sharing
- Rosetta 2: x86_64 Binary Translation on Apple Silicon
Chapter 11: Security Architecture
- System Integrity Protection (SIP): Restricted Paths and Operations
- AMFI: The Kernel Code Signing Enforcement Engine
- Gatekeeper and the Quarantine Attribute
- macOS Sandbox: Policy Language, Profiles and Enforcement
- TCC (Transparency, Consent and Control) Privacy Architecture
- Endpoint Security Framework and Real-Time Threat Detection
- Modern Kernel Protections: KASLR, PPC64 and PPL
Chapter 12: Virtualization and Hypervisor.framework
- The Apple Silicon Hypervisor: Hardware Virtualization Extensions
- Hypervisor.framework API: Creating and Managing VMs
- Memory Mapping and Shared Regions in Guests
- Device Passthrough and Virtual I/O
- Virtualization Security Isolation and Guest Sandboxing
Chapter 13: Power Management and Energy Efficiency
- The IOPowerManagement Architecture
- CPU Power States: P-States, C-States and Cluster Management
- Energy Scheduler: Integrating Power Awareness into Scheduling
- Thermal Management and Throttling Mechanisms
- Battery Life Optimization on Apple Silicon Macs
Chapter 14: Debugging, Tracing and Performance Analysis
- DTrace: Dynamic Tracing Architecture and Providers
- The Instruments Framework: Time Profiler, Allocations and System Trace
- Kernel Debugging: KDP, Boot Args and Live Kernel Analysis
- Performance Monitoring: AMU Counters and the PMU Interface
- Reverse Engineering macOS: Tools, Techniques and Limitations
Chapter 15: Conclusion: The Future of macOS Internals
- Key Architectural Takeaways
- The Apple Silicon Transition: Complete and What It Means
- Emerging Trends: Kernel Consolidation, Security Hardening and AI Integration
- Where to Go From Here: Resources and Community

