Skip to content

Subsystem · The microkernel core

Mach

Tasks, threads, ports, messages, and the virtual-memory primitives every other layer is built on top of.

Mach tasks, threads, and port rightsTwo tasks, each owning threads and a port-right table. Both hold send rights to a single port whose receive right and queue live in the kernel.Task Avm_map · ipc_spacethread 1thread 2PORT RIGHTS0x103send0x207recv0x301send-onceTask Bvm_map · ipc_spacethread 1PORT RIGHTS0x901send0xA12recvKernelipc_portmessage queueFIFO of mach_msgmsg #1msg #2sendsendBoth tasks can send. Only one task (the receiver) dequeues.The name 0x103 in Task A and 0x901 in Task B point at the same port.
Mach: structure at a glance.

Articles in this series

Tasks, ports, messages, and rights — the IPC primitive that quietly carries every IPC on your Mac, from XPC to drag-and-drop.
Real-time, fixed-priority, timeshare, idle — four scheduling classes, 128 priorities, and a QoS layer on top. Here's how XNU picks a thread to put on a core.