OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man2 / sched_setaffinity.2
index 37ef7d3..e84b76c 100644 (file)
@@ -1,8 +1,7 @@
-.\" man2/sched_setaffinity.2 - sched_setaffinity and sched_getaffinity man page
-.\"
 .\" Copyright (C) 2002 Robert Love
 .\" and Copyright (C) 2006 Michael Kerrisk
 .\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
 .\" This is free documentation; you can redistribute it and/or
 .\" modify it under the terms of the GNU General Public License as
 .\" published by the Free Software Foundation; either version 2 of
@@ -19,9 +18,9 @@
 .\" GNU General Public License for more details.
 .\"
 .\" You should have received a copy of the GNU General Public
-.\" License along with this manual; if not, write to the Free
-.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
-.\" USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
 .\"
 .\" 2002-11-19 Robert Love <rml@tech9.net> - initial version
 .\" 2004-04-20 mtk - fixed description of return value
 .\" 2008-11-12, mtk, removed CPU_*() macro descriptions to a
 .\" separate CPU_SET(3) page.
 .\"
-.TH SCHED_SETAFFINITY 2 2010-09-10 "Linux" "Linux Programmer's Manual"
+.TH SCHED_SETAFFINITY 2 2013-09-17 "Linux" "Linux Programmer's Manual"
 .SH NAME
 sched_setaffinity, sched_getaffinity \- \
-set and get a process's CPU affinity mask
+set and get a thread's CPU affinity mask
 .SH SYNOPSIS
 .nf
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
@@ -48,18 +47,18 @@ set and get a process's CPU affinity mask
 .BI "                      cpu_set_t *" mask );
 .fi
 .SH DESCRIPTION
-A process's CPU affinity mask determines the set of CPUs on which
+A thread's CPU affinity mask determines the set of CPUs on which
 it is eligible to run.
 On a multiprocessor system, setting the CPU affinity mask
 can be used to obtain performance benefits.
 For example,
-by dedicating one CPU to a particular process
-(i.e., setting the affinity mask of that process to specify a single CPU,
-and setting the affinity mask of all other processes to exclude that CPU),
-it is possible to ensure maximum execution speed for that process.
-Restricting a process to run on a single CPU also avoids
+by dedicating one CPU to a particular thread
+(i.e., setting the affinity mask of that thread to specify a single CPU,
+and setting the affinity mask of all other threads to exclude that CPU),
+it is possible to ensure maximum execution speed for that thread.
+Restricting a thread to run on a single CPU also avoids
 the performance cost caused by the cache invalidation that occurs
-when a process ceases to execute on one CPU and then
+when a thread ceases to execute on one CPU and then
 recommences execution on a different CPU.
 
 A CPU affinity mask is represented by the
@@ -70,13 +69,13 @@ A set of macros for manipulating CPU sets is described in
 .BR CPU_SET (3).
 
 .BR sched_setaffinity ()
-sets the CPU affinity mask of the process whose ID is
+sets the CPU affinity mask of the thread whose ID is
 .I pid
 to the value specified by
 .IR mask .
 If
 .I pid
-is zero, then the calling process is used.
+is zero, then the calling thread is used.
 The argument
 .I cpusetsize
 is the length (in bytes) of the data pointed to by
@@ -84,15 +83,15 @@ is the length (in bytes) of the data pointed to by
 Normally this argument would be specified as
 .IR "sizeof(cpu_set_t)" .
 
-If the process specified by
+If the thread specified by
 .I pid
 is not currently running on one of the CPUs specified in
 .IR mask ,
-then that process is migrated to one of the CPUs specified in
+then that thread is migrated to one of the CPUs specified in
 .IR mask .
 
 .BR sched_getaffinity ()
-writes the affinity mask of the process whose ID is
+writes the affinity mask of the thread whose ID is
 .I pid
 into the
 .I cpu_set_t
@@ -104,8 +103,8 @@ argument specifies the size (in bytes) of
 .IR mask .
 If
 .I pid
-is zero, then the mask of the calling process is returned.
-.SH "RETURN VALUE"
+is zero, then the mask of the calling thread is returned.
+.SH RETURN VALUE
 On success,
 .BR sched_setaffinity ()
 and
@@ -123,7 +122,7 @@ A supplied memory address was invalid.
 The affinity bit mask
 .I mask
 contains no processors that are currently physically on the system
-and permitted to the process according to any restrictions that
+and permitted to the thread according to any restrictions that
 may be imposed by the "cpuset" mechanism described in
 .BR cpuset (7).
 .TP
@@ -136,16 +135,16 @@ is smaller than the size of the affinity mask used by the kernel.
 .TP
 .B EPERM
 .RB ( sched_setaffinity ())
-The calling process does not have appropriate privileges.
-The caller needs an effective user ID equal to the user ID
-or effective user ID of the process identified by
+The calling thread does not have appropriate privileges.
+The caller needs an effective user ID equal to the real user ID
+or effective user ID of the thread identified by
 .IR pid ,
 or it must possess the
 .B CAP_SYS_NICE
 capability.
 .TP
 .B ESRCH
-The process whose ID is \fIpid\fP could not be found.
+The thread whose ID is \fIpid\fP could not be found.
 .SH VERSIONS
 The CPU affinity system calls were introduced in Linux kernel 2.5.8.
 The system call wrappers were introduced in glibc 2.3.
@@ -157,26 +156,26 @@ In glibc 2.3.3, the
 .I cpusetsize
 argument was removed, but was then restored in glibc 2.3.4, with type
 .IR size_t .
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 These system calls are Linux-specific.
-.SH "NOTES"
+.SH NOTES
 After a call to
 .BR sched_setaffinity (),
-the set of CPUs on which the process will actually run is
+the set of CPUs on which the thread will actually run is
 the intersection of the set specified in the
 .I mask
 argument and the set of CPUs actually present on the system.
-The system may further restrict the set of CPUs on which the process
+The system may further restrict the set of CPUs on which the thread
 runs if the "cpuset" mechanism described in
 .BR cpuset (7)
 is being used.
-These restrictions on the actual set of CPUs on which the process
+These restrictions on the actual set of CPUs on which the thread
 will run are silently imposed by the kernel.
 
 .BR sched_setscheduler (2)
 has a description of the Linux scheduling scheme.
 .PP
-The affinity mask is actually a per-thread attribute that can be
+The affinity mask is a per-thread attribute that can be
 adjusted independently for each of the threads in a thread group.
 The value returned from a call to
 .BR gettid (2)
@@ -203,7 +202,7 @@ This manual page describes the glibc interface for the CPU affinity calls.
 The actual system call interface is slightly different, with the
 .I mask
 being typed as
-.IR "unsigned long *" ,
+.IR "unsigned long\ *" ,
 reflecting the fact that the underlying implementation of CPU
 sets is a simple bit mask.
 On success, the raw
@@ -212,7 +211,10 @@ system call returns the size (in bytes) of the
 .I cpumask_t
 data type that is used internally by the kernel to
 represent the CPU set bit mask.
-.SH "SEE ALSO"
+.SH SEE ALSO
+.ad l
+.nh
+.BR taskset (1),
 .BR clone (2),
 .BR getcpu (2),
 .BR getpriority (2),
@@ -228,3 +230,11 @@ represent the CPU set bit mask.
 .BR sched_getcpu (3),
 .BR capabilities (7),
 .BR cpuset (7)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.