Glossary
Task (Mach)
The Mach object that owns a process's address space, threads, and port rights. Paired with a BSD `proc` to form what userspace calls a process.
A task in Mach terms is what owns:
- A virtual memory map (
vm_map). - A set of port rights (
ipc_space). - One or more threads.
Every process you see in Activity Monitor has a Mach task underneath it. The BSD proc (with the pid_t, the file descriptors, the parent/child links) is a separate structure with a pointer to the task — the two halves of XNU meet at that pointer.
apple-oss-distributions/xnuosfmk/kern/task.htask structure — the Mach side of every process.View on GitHub(line —) apple-oss-distributions/xnubsd/sys/proc_internal.h:180struct proc.task — the BSD side's pointer into Mach.View on GitHub(line 180)
The task you currently run as is reachable via mach_task_self(), which returns a send right to your own task port. With that send right and the right entitlements you can call task_threads, mach_vm_read, mach_vm_write — every debugger and instrumentation tool on macOS works through this surface.