Apple Silicon processors feature a heterogeneous CPU architecture combining high-performance Performance (P) cores with power-efficient Efficiency (E) cores. When executing resource-heavy background scripts, media conversions, or compilation tasks, macOS may assign threads across all cores, increasing power consumption and generating heat. The built-in taskpolicy command-line utility in macOS Terminal allows developers and power users to set explicit Quality of Service (QoS) tiers, clamp process CPU limits, and restrict background tasks exclusively to Efficiency cores.
Understanding macOS Quality of Service (QoS)
The Darwin kernel dynamically schedules tasks using Grand Central Dispatch (GCD) QoS classes. By declaring an appropriate QoS policy, you inform the kernel’s scheduler how aggressively to allocate hardware resources:
- User Interactive: Highest priority, scheduled immediately on P-cores with maximum clock frequencies for animations and UI responsiveness.
- User Initiated: High priority for tasks actively awaited by the user.
- Default / Utility: Moderate priority for tasks with progress bars or long calculations.
- Background: Lowest priority, throttles disk I/O, and executes on E-cores to preserve battery life and keep the UI fluid.
- Maintenance: Periodic cleanup jobs that execute only when the Mac is plugged into AC power and idle.
Syntax and Key Parameters
taskpolicy [-b | -t | -c class | -d clamp] [command [arguments] | -p pid]
-b: Launches a program with the standard Background QoS tier.-t: Sets the through-throughput tier.-c <class>: Sets explicit QoS class:user-interactive,user-initiated,default,utility,background, ormaintenance.-d <clamp>: Enforces scheduler clamping.-d clamprestricts the target process exclusively to E-cores.-p <pid>: Applies the policy to an already running process identified by its Process ID.
Step-by-Step Practical Implementation
Step 1: Open Terminal
Open Terminal from /Applications/Utilities/.
Step 2: Launching a Heavy Script Strictly on Efficiency Cores
To run an FFmpeg video transcode or Python data processing script without spinning fans or competing with foreground applications, use the background flag and scheduler clamp:
taskpolicy -b -d clamp ffmpeg -i input.mov -c:v libx265 output.mp4
The Darwin scheduler will pin execution threads exclusively to the M-series Efficiency cores.
Step 3: Throttling an Already Running Process
- Find the PID of a runaway compilation or background process using
pgrep:pgrep -x "node" - Assume the returned PID is
14820. Clamp the process to the background tier:taskpolicy -p 14820 -b -d clamp - The process immediately shifts from Performance cores to Efficiency cores.
Step 4: Elevating Priority for Time-Critical Tasks
Conversely, to ensure a real-time audio synthesis or benchmark script receives maximum scheduling priority:
taskpolicy -c user-interactive ./realtime_audio_engine
taskpolicy QoS Classes Comparison
| QoS Class Argument | Relative Priority | Hardware Core Target | Disk & Network I/O Priority | Recommended Use Case |
|---|---|---|---|---|
user-interactive |
Maximum | Performance (P) Cores | High throughput, low latency | Audio playback, real-time rendering, UI animations |
user-initiated |
High | Performance (P) Cores | Normal priority | Opening documents, loading web pages, manual user searches |
default |
Standard | Balanced P/E Cores | Standard | General application workloads lacking explicit QoS tags |
utility |
Low | Mixed / Favours E-Cores | Throttled during load | File exports, database synchronization, bulk downloading |
background |
Lowest | Efficiency (E) Cores strictly | Aggressively throttled (Tier 3) | Backups, indexing, bulk media transcoding, virus scanning |
Operational Notes and Best Practices
- Elevated Permissions for Target PIDs: Modifying the QoS policy of processes owned by root or other user accounts requires running
sudo taskpolicy -p <pid>. - Verifying with powermetrics: To visually observe the scheduler core allocation shift in real time, run
sudo powermetrics -s cpu_powerin a separate terminal window and inspect the active CPU residency clusters. - Process Tree Inheritance: Any child sub-processes spawned by an application launched via
taskpolicywill inherit the clamped background QoS tier automatically.