Deepin Linux
Deepin Linux
Jan 3, 2026 · Operations

Boost Linux Performance: Master CPU Affinity and Scheduling

This article explains the fundamentals of Linux CPU affinity, compares soft and hard binding, shows how to use taskset, sched_setaffinity, numactl and cgroup cpuset, and provides real‑world case studies for servers, game frameworks, Nginx and Hadoop clusters.

CPU schedulingLinux performancecgroups
0 likes · 36 min read
Boost Linux Performance: Master CPU Affinity and Scheduling
Liangxu Linux
Liangxu Linux
Aug 4, 2024 · Fundamentals

Unlock CPU Performance: Master Hyper‑Threading and Affinity on Linux

This article explains hyper‑threading fundamentals, distinguishes physical, logical, and CPU cores, shows how to query CPU topology on Linux, introduces the concept of CPU affinity, demonstrates using the taskset command and related syscalls, and provides C API examples for setting process and thread affinity.

Hyper-threadingLinuxcpu_affinity
0 likes · 14 min read
Unlock CPU Performance: Master Hyper‑Threading and Affinity on Linux
Liangxu Linux
Liangxu Linux
May 14, 2024 · Fundamentals

Mastering CPU Affinity and Hyper‑Threading on Linux

This guide explains the concepts of Hyper‑Threading, physical vs logical CPUs, how to query CPU information on Linux, and provides detailed instructions for using the taskset command and related programming APIs to set and retrieve CPU affinity for processes and threads.

Linuxcpu_affinitymultithreading
0 likes · 12 min read
Mastering CPU Affinity and Hyper‑Threading on Linux
Liangxu Linux
Liangxu Linux
Jul 6, 2021 · Fundamentals

How Linux Implements CPU Affinity: From sched_setaffinity to Task Migration

This article explains why binding a process to a specific CPU improves cache performance, shows how to set CPU affinity on Linux using the sched_setaffinity system call, and walks through the kernel's internal implementation—including run‑queue structures, migrate_task, and __migrate_task—illustrated with code and diagrams.

Linuxcpu_affinitykernel migration
0 likes · 9 min read
How Linux Implements CPU Affinity: From sched_setaffinity to Task Migration