6.9 · How a process dies, what it costs, what confines it and what seals it
An app is a process, and a process has an exit status, a memory bill, a sandbox profile and a code signature. Each one can be inspected with ordinary tools.
Mental model. Everything the platform does to your app is visible as a signal, a kernel counter, a denied system call or a failed signature check. Learn to read those four and the crash logs stop being mysterious.
Dying and measuring
Exit statuses and signals, and the one memory number that counts.
- How does a process end, and which signal or exit status does each kind of failure produce?
A process ends in one of two ways: it exits with a status (exit(3), or returning from main), or the kernel kills it with a signal. The check separates them… - Which memory number does the system judge your app by, and why do virtual size and “resident” mislead?
A process has several sizes. Virtual size is the address space you have reserved: in the check, mapping 200 MB with mmap raised it by about 200 MB and raised…
Confinement and signatures
How the sandbox says no, and what a code signature actually seals.
- How is the sandbox actually enforced, what does a denied operation look like, and what does the simulator not enforce?
The iOS sandbox is the same Seatbelt mechanism that exists on macOS: a profile is attached to the process at launch and the kernel checks it on each operation…
More in iOS platform internals
- 6.1 · The process, the sandbox, entitlements and privacy prompts
- 6.2 · App and scene lifecycle in UIKit and SwiftUI
- 6.3 · The run loop, its modes, and the main-thread contract
- 6.4 · The launch path: dyld, initialisers and the first frame
- 6.5 · Background modes, BGTaskScheduler and background transfers
- 6.6 · Memory warnings, jetsam and the watchdog
- 6.7 · Info.plist, URL schemes, universal links and associated domains
- 6.8 · App groups, keychain groups and extensions as separate processes
- 6.10 · Threads and run loops, observers, and what actually runs in a custom mode
- 6.11 · Launch arguments, the scene callbacks, and reading a binary and its plists