Skip to main content

2 posts tagged with "XNU"

XNU kernel and Mach layer internals

View All Tags

Thread Execution, Scheduling, and Multiprocessing on XNU

· 42 min read
Pranav Ram Joshi
Software Engineer — Systems & Networks

Man is born free, and everywhere he is in chains. - Jean-Jacques Rousseau; The Social Contract

Preamble​

This post explores how XNU — the kernel behind macOS and iOS — schedules and executes threads across processors. We'll look at preemptive scheduling, the Mach continuation model that allows kernel stacks to be reclaimed, and the hardware topology that underlies multiprocessing: cores, dies, SMT, and the distinction between symmetric and asymmetric multiprocessing.

This post builds on the Mach abstractions covered in Mach Kernel Abstractions and XNU Internals. Familiarity with Mach tasks and threads will be helpful but is not strictly required.

Mach Kernel Abstractions and XNU Internals

· 24 min read
Pranav Ram Joshi
Software Engineer — Systems & Networks

Search for the truth is the noblest occupation of man; its publication is a duty. - Anne Louise Germaine de Staël; De l'Allemagne

Preamble: XNU and the Mach Kernel​

An operating system is a set of system software that acts as a bridge between the application software and the underlying hardware. Among the various software packaged with an operating system is the kernel — a program responsible for communicating with the hardware and managing the system in its entirety. The purpose of this post is to explore the XNU kernel source and understand the core abstractions of the Mach kernel that underpin the macOS kernel architecture. We'll walk through Mach's taxonomy — tasks, threads, IPC ports, processor sets — and examine the XNU-specific implementation details, including pointer authentication and key Mach routines like task_info and mach_task_self.