Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Processor affinity
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Specific operating systems== On [[Linux]], the CPU affinity of a process can be altered with the taskset(1) program<ref>{{man|1|taskset|Linux}}</ref> and the sched_setaffinity(2) system call. The affinity of a thread can be altered with one of the library functions: pthread_setaffinity_np(3) or pthread_attr_setaffinity_np(3). On [[Silicon Graphics|SGI]] systems, [https://web.archive.org/web/20070701091047/http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=man&fname=%2Fusr%2Fshare%2Fcatman%2Fman1%2Fdplace.1.html dplace] binds a process to a set of CPUs.<ref>[http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=man&fname=/usr/share/catman/man1/dplace.1.html dplace.1] {{webarchive|url=https://web.archive.org/web/20070701091047/http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=man&fname=%2Fusr%2Fshare%2Fcatman%2Fman1%2Fdplace.1.html |date=2007-07-01 }} - From ''[http://www.sgi.com sgi.com]''. Accessed 2007-07-06.</ref> On [[DragonFly BSD]] 1.9 (2007) and later versions, usched_set system call can be used to control the affinity of a process.<ref>{{cite web |url= http://mdoc.su/d/usched_set.2 |title= <code>usched_set(2)</code> β setting up a proc's usched |work= DragonFly System Calls Manual |publisher= [[DragonFly BSD]] |access-date= 2019-07-28 }}</ref><ref>{{cite web |url= http://bxr.su/d/sys/kern/kern_usched.c#sys_usched_set |title= <code>kern/kern_usched.c Β§ sys_usched_set</code> |website= BSD Cross Reference |publisher= [[DragonFly BSD]] |access-date= 2019-07-28 }}</ref> On [[NetBSD]] 5.0, [[FreeBSD]] 7.2, [[DragonFly BSD]] 4.7 and later versions can use pthread_setaffinity_np and pthread_getaffinity_np.<ref><code>{{URL|http://mdoc.su/n,f,d/pthread_setaffinity_np.3|pthread_setaffinity_np(3)}}</code> β [[NetBSD]], [[FreeBSD]] and [[DragonFly BSD]] Library Functions Manual</ref> In [[NetBSD]], the psrset utility<ref>{{man|8|psrset|NetBSD}}</ref> to set a thread's affinity to a certain CPU set. In [[FreeBSD]], cpuset<ref>{{man|1|cpuset|FreeBSD}}</ref> utility is used to create CPU sets and to assign processes to these sets. In [[DragonFly BSD]] 3.1 (2012) and later, usched utility can be used for assigning processes to a certain CPU set.<ref>{{cite web |url= http://mdoc.su/d/usched.8 |title= <code>usched(8)</code> β run a program with a specified userland scheduler and cpumask |work= DragonFly System Manager's Manual |publisher= [[DragonFly BSD]] |access-date= 2019-07-28 }}</ref> On [[Windows NT]] and its successors, thread and process CPU affinities can be set separately by using SetThreadAffinityMask<ref>[http://msdn2.microsoft.com/en-us/library/ms686247(VS.85).aspx SetThreadAffinityMask] - [[MSDN Library]]</ref> and SetProcessAffinityMask<ref>[http://msdn2.microsoft.com/en-us/library/ms686223(VS.85).aspx SetProcessAffinityMask] - [[MSDN Library]]</ref> API calls or via the Task Manager interface (for process affinity only). [[macOS]] exposes an affinity API<ref>{{cite web|url=https://developer.apple.com/library/mac/#releasenotes/Performance/RN-AffinityAPI/index.html|title=Thread Affinity API Release Notes|website=Developer.apple.com}}</ref> that provides hints to the kernel how to schedule threads according to affinity sets. On [[Solaris (operating system)|Solaris]] it is possible to control bindings of processes and LWPs to processor using the pbind(1)<ref>[http://docs.oracle.com/cd/E23824_01/html/821-1462/pbind-1m.html pbind(1M)] - Solaris man page</ref> program. To control the affinity programmatically processor_bind(2)<ref>[http://docs.oracle.com/cd/E19109-01/tsolaris8/817-0881/6mglbsoma/index.html processor_bind(2)] - Solaris man page</ref> can be used. There are more generic interfaces available such as pset_bind(2)<ref>[http://docs.oracle.com/cd/E26502_01/html/E29032/pset-bind-2.html#REFMAN2pset-bind-2 pset_bind(2)] - Oracle Solaris 11.1 Information Library - man pages section 2</ref> or lgrp_affinity_get(3LGRP)<ref>[http://docs.oracle.com/cd/E19120-01/open.solaris/820-1691/lgroups-193/index.html lgrp_affinity_get(3LGRP)] - Memory and Thread Placement Optimization Developer's Guide</ref> using processor set and locality groups concepts. On [[IBM AIX|AIX]] it is possible to control bindings of processes using the bindprocessor command<ref name="processor-affinity-on-aix">{{cite web|url=https://www.ibm.com/developerworks/aix/library/au-processinfinity.html|title=Processor affinity on AIX|author1=Umesh Prabhakar Gaikwad|author2=Kailas S. Zadbuke|website=[[IBM]] |date=November 16, 2006}}</ref><ref>{{cite web|url=https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/b_commands/bindprocessor.html|title=bindprocessor Command|website=IBM}}</ref> and the bindprocessor API.<ref name="processor-affinity-on-aix"/><ref>{{cite web|url=https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/b_bostechref/bindprocessor.html|title=bindprocessor Subroutine|website=IBM}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)