CPU affinity is a setting that tells Windows which processor cores a specific process is allowed to run on. By default, Windows distributes threads across all available cores as it sees fit. But in some situations — particularly gaming, audio production, or running background-heavy workloads — manually pinning a process to specific cores gives you more predictable performance and can reduce resource contention.
This guide explains what CPU affinity actually does, when it helps, and how to configure it using Task Manager and PowerShell in Windows 11.
What Is CPU Affinity?
Modern CPUs have multiple cores, and the Windows kernel scheduler decides in real time which core runs which thread. Normally this works well, but there are edge cases:
- Hybrid CPU architectures (Intel Core Ultra, 12th Gen and later) mix Performance cores (P-cores) and Efficiency cores (E-cores). Some games or latency-sensitive apps run poorly when scheduled onto E-cores.
- Background tasks can steal time from a game or audio interface running on the same cores.
- Emulators and legacy apps occasionally run better pinned to a single core to avoid cache coherency overhead from thread migration.
Setting CPU affinity pins a process to a specified subset of cores (a “CPU mask”), so the scheduler only places its threads there.
Important caveat: Affinity is not a silver bullet. Restricting a multi-threaded app to fewer cores can hurt performance if the app genuinely needs them. Always benchmark before and after.
Method 1: Task Manager (GUI)
This is the quickest method but does not persist after the process restarts.
- Press Ctrl + Shift + Esc to open Task Manager.
- Click the Details tab (not Processes — Details gives per-process control).
- Find the process you want to modify. Right-click it and select Set affinity.
- A dialog appears listing every logical CPU (CPU 0, CPU 1, CPU 2…). Check only the cores you want to allow.
- Click OK.
Example: Pinning a game to P-cores only on an Intel hybrid CPU
On a Core i9-13900K, logical CPUs 0–15 correspond to P-cores (with hyperthreading), and 16–31 are E-cores. To keep a game off E-cores, uncheck CPU 16 through CPU 31 in the affinity dialog.
The change takes effect immediately. The next time you launch the same process, Windows reverts to default behavior. To make affinity persistent, use the PowerShell or scripting methods below.
Method 2: PowerShell — One-Shot Affinity Change
PowerShell can read and set the ProcessorAffinity property on any running process object.
View current affinity for a process
Get-Process -Name "notepad" | Select-Object Name, ProcessorAffinity
The ProcessorAffinity value is a bitmask. Each bit represents a logical CPU:
| Bitmask (decimal) | Binary | Active CPUs |
|---|---|---|
| 1 | 00000001 | CPU 0 only |
| 3 | 00000011 | CPU 0 and 1 |
| 15 | 00001111 | CPU 0–3 |
| 255 | 11111111 | CPU 0–7 |
| 65535 | 1111111111111111 | CPU 0–15 |
Set affinity using PowerShell
$process = Get-Process -Name "RustClient"
$process.ProcessorAffinity = 0x00FF # Pins to CPUs 0–7 (first 8 logical cores)
Replace RustClient with the exact process name from Task Manager (without .exe).
To calculate the bitmask for your target cores, sum the powers of two for each core number:
- CPU 0 = 2^0 = 1
- CPU 1 = 2^1 = 2
- CPU 2 = 2^2 = 4
- CPU 4 = 2^4 = 16
So CPUs 0, 1, 2, and 4 = 1 + 2 + 4 + 16 = 23 decimal.
Method 3: Persistent Affinity via a Launch Script
Since Task Manager resets affinity on relaunch, the cleanest approach for games or apps you start regularly is a PowerShell launch wrapper.
Create a file called launch-game.ps1:
# Launch the game
Start-Process "C:\Games\MyGame\game.exe"
# Wait for the process to appear
Start-Sleep -Seconds 3
# Find and pin it
$proc = Get-Process -Name "game" -ErrorAction SilentlyContinue
if ($proc) {
$proc.ProcessorAffinity = 0x00FF # CPUs 0-7
Write-Host "Affinity set for $($proc.Name) (PID $($proc.Id))"
} else {
Write-Host "Process not found."
}
Run it with:
powershell -ExecutionPolicy Bypass -File "C:\Scripts\launch-game.ps1"
You can pin this script as a desktop shortcut to replace your normal game launcher.
Method 4: Using start from the Command Prompt
The built-in start command in CMD supports an /affinity flag directly:
start /affinity 0xFF "MyGame" "C:\Games\MyGame\game.exe"
The hex value after /affinity is the same bitmask as before. 0xFF = CPUs 0–7. This launches the process immediately with the specified affinity — no waiting required.
Method 5: Process Lasso (Third-Party, Persistent)
If you want a GUI tool that remembers affinity settings across reboots, Process Lasso (by Bitsum) is the most capable free option. It can:
- Permanently save per-process CPU affinity rules
- Set I/O and RAM priority alongside CPU affinity
- Apply rules automatically whenever a process starts
Install it from bitsum.com, right-click any process in its interface, and choose CPU Affinity > Always. Lasso runs as a background service and enforces the rule every time that executable is detected.
Practical Use Cases
Isolating a game from background processes
Pin your game to cores 0–11 and let your Discord/browser/capture software run on cores 12–15. This prevents the browser from occasionally stealing a scheduler slot from the game.
Fixing audio crackle on hybrid CPUs
Audio drivers and DAW plugins can crack or glitch when threads migrate from P-cores to E-cores mid-buffer. Pin your DAW process (e.g., Ableton Live.exe) to P-cores only.
Legacy or single-threaded software
Old apps sometimes behave erratically on multi-core systems due to timing assumptions. Pinning them to CPU 0 only can restore stability.
Checking Your Work
After setting affinity, verify it took effect:
Get-Process -Name "game" | Select-Object Name, Id, ProcessorAffinity
You can also watch per-core utilization in Task Manager: go to the Performance tab, click CPU, right-click the graph, and select Change graph to > Logical processors. You should see activity only on the pinned cores.
CPU affinity is a precision tool. Used thoughtfully, it can smooth out hitches on hybrid CPUs and eliminate resource contention between competing processes. Used carelessly — like pinning a heavily threaded renderer to a single core — it will hurt performance. Test carefully and keep benchmarks handy.