This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
realtime:documentation:howto:tools:cpu_affinity [2017/05/03 21:43] srodrig1 Adding system calls and command line commands |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== CPU Affinity ====== | ||
- | In a SMP system the property that binds processes to one or more processors by the OS scheduler is know as CPU affinity, the capability to override how the processes are assigned to a particular set of processors by the scheduler is a feature available in several OS. The idea is to say “always run this process on processor one” or “run these processes on all processors but processor zero”. The scheduler then obeys the order, and the process runs only on the allowed processors. | ||
- | |||
- | In the Linux case we have mechanisms to set the CPU affinity in user space | ||
- | |||
- | ===== System Calls ===== | ||
- | Linux provides a couple of system calls to set the and get the affinity of the current process, this are: | ||
- | * sched_getaffinity | ||
- | * sched_setaffinity | ||
- | The official description on these system calls and data structures used can be obtain from | ||
- | [[http://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html|The GNU C Library: CPU Affinity]] | ||
- | ===== Taskset command ===== | ||
- | The taskset command sets and checks affinity information for a given process. The manual page describes this command [[http://man7.org/linux/man-pages/man1/taskset.1.html|taskset]] | ||
- | |||
- | |||