| 1 |
# SOME DESCRIPTIVE TITLE |
| 2 |
# Copyright (C) YEAR Free Software Foundation, Inc. |
| 3 |
# This file is distributed under the same license as the PACKAGE package. |
| 4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 |
# |
| 6 |
#, fuzzy |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: PACKAGE VERSION\n" |
| 10 |
"POT-Creation-Date: 2026-06-05 06:42+0200\n" |
| 11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: LANGUAGE <[email protected]>\n" |
| 14 |
"Language: \n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
|
| 19 |
#. type: TH |
| 20 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 21 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 22 |
#, no-wrap |
| 23 |
msgid "sched_setaffinity" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 28 |
#: opensuse-tumbleweed |
| 29 |
#, no-wrap |
| 30 |
msgid "2026-02-08" |
| 31 |
msgstr "" |
| 32 |
|
| 33 |
#. type: TH |
| 34 |
#: archlinux debian-unstable |
| 35 |
#, no-wrap |
| 36 |
msgid "Linux man-pages 6.18" |
| 37 |
msgstr "" |
| 38 |
|
| 39 |
#. type: SH |
| 40 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 41 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 42 |
#, no-wrap |
| 43 |
msgid "NAME" |
| 44 |
msgstr "" |
| 45 |
|
| 46 |
#. type: Plain text |
| 47 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 48 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 49 |
msgid "" |
| 50 |
"sched_setaffinity, sched_getaffinity - set and get a thread's CPU affinity " |
| 51 |
"mask" |
| 52 |
msgstr "" |
| 53 |
|
| 54 |
#. type: SH |
| 55 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 56 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 57 |
#, no-wrap |
| 58 |
msgid "LIBRARY" |
| 59 |
msgstr "" |
| 60 |
|
| 61 |
#. type: Plain text |
| 62 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 63 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 64 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 65 |
msgstr "" |
| 66 |
|
| 67 |
#. type: SH |
| 68 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 69 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 70 |
#, no-wrap |
| 71 |
msgid "SYNOPSIS" |
| 72 |
msgstr "" |
| 73 |
|
| 74 |
#. type: Plain text |
| 75 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 76 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 77 |
#, no-wrap |
| 78 |
msgid "" |
| 79 |
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 80 |
"B<#include E<lt>sched.hE<gt>>\n" |
| 81 |
msgstr "" |
| 82 |
|
| 83 |
#. type: Plain text |
| 84 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 85 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 86 |
#, no-wrap |
| 87 |
msgid "" |
| 88 |
"B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n" |
| 89 |
"B< const cpu_set_t *>I<mask>B<);>\n" |
| 90 |
"B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n" |
| 91 |
"B< cpu_set_t *>I<mask>B<);>\n" |
| 92 |
msgstr "" |
| 93 |
|
| 94 |
#. type: SH |
| 95 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 96 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 97 |
#, no-wrap |
| 98 |
msgid "DESCRIPTION" |
| 99 |
msgstr "" |
| 100 |
|
| 101 |
#. type: Plain text |
| 102 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 103 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 104 |
msgid "" |
| 105 |
"A thread's CPU affinity mask determines the set of CPUs on which it is " |
| 106 |
"eligible to run. On a multiprocessor system, setting the CPU affinity mask " |
| 107 |
"can be used to obtain performance benefits. For example, by dedicating one " |
| 108 |
"CPU to a particular thread (i.e., setting the affinity mask of that thread " |
| 109 |
"to specify a single CPU, and setting the affinity mask of all other threads " |
| 110 |
"to exclude that CPU), it is possible to ensure maximum execution speed for " |
| 111 |
"that thread. Restricting a thread to run on a single CPU also avoids the " |
| 112 |
"performance cost caused by the cache invalidation that occurs when a thread " |
| 113 |
"ceases to execute on one CPU and then recommences execution on a different " |
| 114 |
"CPU." |
| 115 |
msgstr "" |
| 116 |
|
| 117 |
#. type: Plain text |
| 118 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 119 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 120 |
msgid "" |
| 121 |
"A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU " |
| 122 |
"set\", pointed to by I<mask>. A set of macros for manipulating CPU sets is " |
| 123 |
"described in B<CPU_SET>(3)." |
| 124 |
msgstr "" |
| 125 |
|
| 126 |
#. type: Plain text |
| 127 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 128 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 129 |
msgid "" |
| 130 |
"B<sched_setaffinity>() sets the CPU affinity mask of the thread whose ID is " |
| 131 |
"I<pid> to the value specified by I<mask>. If I<pid> is zero, then the " |
| 132 |
"calling thread is used. The argument I<cpusetsize> is the length (in bytes) " |
| 133 |
"of the data pointed to by I<mask>. Normally this argument would be " |
| 134 |
"specified as I<sizeof(cpu_set_t)>." |
| 135 |
msgstr "" |
| 136 |
|
| 137 |
#. type: Plain text |
| 138 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 139 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 140 |
msgid "" |
| 141 |
"If the thread specified by I<pid> is not currently running on one of the " |
| 142 |
"CPUs specified in I<mask>, then that thread is migrated to one of the CPUs " |
| 143 |
"specified in I<mask>." |
| 144 |
msgstr "" |
| 145 |
|
| 146 |
#. type: Plain text |
| 147 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 148 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 149 |
msgid "" |
| 150 |
"B<sched_getaffinity>() writes the affinity mask of the thread whose ID is " |
| 151 |
"I<pid> into the I<cpu_set_t> structure pointed to by I<mask>. The " |
| 152 |
"I<cpusetsize> argument specifies the size (in bytes) of I<mask>. If I<pid> " |
| 153 |
"is zero, then the mask of the calling thread is returned." |
| 154 |
msgstr "" |
| 155 |
|
| 156 |
#. type: SH |
| 157 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 158 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 159 |
#, no-wrap |
| 160 |
msgid "RETURN VALUE" |
| 161 |
msgstr "" |
| 162 |
|
| 163 |
#. type: Plain text |
| 164 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 165 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 166 |
msgid "" |
| 167 |
"On success, B<sched_setaffinity>() and B<sched_getaffinity>() return 0 " |
| 168 |
"(but see \"C library/kernel differences\" below, which notes that the " |
| 169 |
"underlying B<sched_getaffinity>() differs in its return value). On " |
| 170 |
"failure, -1 is returned, and I<errno> is set to indicate the error." |
| 171 |
msgstr "" |
| 172 |
|
| 173 |
#. type: SH |
| 174 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 175 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 176 |
#, no-wrap |
| 177 |
msgid "ERRORS" |
| 178 |
msgstr "" |
| 179 |
|
| 180 |
#. type: TP |
| 181 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 182 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 183 |
#, no-wrap |
| 184 |
msgid "B<EFAULT>" |
| 185 |
msgstr "" |
| 186 |
|
| 187 |
#. type: Plain text |
| 188 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 189 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 190 |
msgid "A supplied memory address was invalid." |
| 191 |
msgstr "" |
| 192 |
|
| 193 |
#. type: TP |
| 194 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 195 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 196 |
#, no-wrap |
| 197 |
msgid "B<EINVAL>" |
| 198 |
msgstr "" |
| 199 |
|
| 200 |
#. type: Plain text |
| 201 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 202 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 203 |
msgid "" |
| 204 |
"The affinity bit mask I<mask> contains no processors that are currently " |
| 205 |
"physically on the system and permitted to the thread according to any " |
| 206 |
"restrictions that may be imposed by I<cpuset> cgroups or the \"cpuset\" " |
| 207 |
"mechanism described in B<cpuset>(7)." |
| 208 |
msgstr "" |
| 209 |
|
| 210 |
#. type: Plain text |
| 211 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 212 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 213 |
msgid "" |
| 214 |
"(B<sched_getaffinity>() and, before Linux 2.6.9, B<sched_setaffinity>()) " |
| 215 |
"I<cpusetsize> is smaller than the size of the affinity mask used by the " |
| 216 |
"kernel." |
| 217 |
msgstr "" |
| 218 |
|
| 219 |
#. type: TP |
| 220 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 221 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 222 |
#, no-wrap |
| 223 |
msgid "B<EPERM>" |
| 224 |
msgstr "" |
| 225 |
|
| 226 |
#. type: Plain text |
| 227 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 228 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 229 |
msgid "" |
| 230 |
"(B<sched_setaffinity>()) The calling thread does not have appropriate " |
| 231 |
"privileges. The caller needs an effective user ID equal to the real user ID " |
| 232 |
"or effective user ID of the thread identified by I<pid>, or it must possess " |
| 233 |
"the B<CAP_SYS_NICE> capability in the user namespace of the thread I<pid>." |
| 234 |
msgstr "" |
| 235 |
|
| 236 |
#. type: TP |
| 237 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 238 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 239 |
#, no-wrap |
| 240 |
msgid "B<ESRCH>" |
| 241 |
msgstr "" |
| 242 |
|
| 243 |
#. type: Plain text |
| 244 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 245 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 246 |
msgid "The thread whose ID is I<pid> could not be found." |
| 247 |
msgstr "" |
| 248 |
|
| 249 |
#. type: SH |
| 250 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 251 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 252 |
#, no-wrap |
| 253 |
msgid "STANDARDS" |
| 254 |
msgstr "" |
| 255 |
|
| 256 |
#. type: Plain text |
| 257 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 258 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 259 |
msgid "Linux." |
| 260 |
msgstr "" |
| 261 |
|
| 262 |
#. type: SH |
| 263 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 264 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 265 |
#, no-wrap |
| 266 |
msgid "HISTORY" |
| 267 |
msgstr "" |
| 268 |
|
| 269 |
#. type: Plain text |
| 270 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 271 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 272 |
msgid "Linux 2.5.8, glibc 2.3." |
| 273 |
msgstr "" |
| 274 |
|
| 275 |
#. type: Plain text |
| 276 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 277 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 278 |
msgid "" |
| 279 |
"Initially, the glibc interfaces included a I<cpusetsize> argument, typed as " |
| 280 |
"I<unsigned int>. In glibc 2.3.3, the I<cpusetsize> argument was removed, " |
| 281 |
"but was then restored in glibc 2.3.4, with type I<size_t>." |
| 282 |
msgstr "" |
| 283 |
|
| 284 |
#. type: SH |
| 285 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 286 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 287 |
#, no-wrap |
| 288 |
msgid "NOTES" |
| 289 |
msgstr "" |
| 290 |
|
| 291 |
#. type: Plain text |
| 292 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 293 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 294 |
msgid "" |
| 295 |
"After a call to B<sched_setaffinity>(), the set of CPUs on which the thread " |
| 296 |
"will actually run is the intersection of the set specified in the I<mask> " |
| 297 |
"argument and the set of CPUs actually present on the system. The system may " |
| 298 |
"further restrict the set of CPUs on which the thread runs if the \"cpuset\" " |
| 299 |
"mechanism described in B<cpuset>(7) is being used. These restrictions on " |
| 300 |
"the actual set of CPUs on which the thread will run are silently imposed by " |
| 301 |
"the kernel." |
| 302 |
msgstr "" |
| 303 |
|
| 304 |
#. type: Plain text |
| 305 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 306 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 307 |
msgid "" |
| 308 |
"There are various ways of determining the number of CPUs available on the " |
| 309 |
"system, including: inspecting the contents of I</proc/cpuinfo>; using " |
| 310 |
"B<sysconf>(3) to obtain the values of the B<_SC_NPROCESSORS_CONF> and " |
| 311 |
"B<_SC_NPROCESSORS_ONLN> parameters; and inspecting the list of CPU " |
| 312 |
"directories under I</sys/devices/system/cpu/>." |
| 313 |
msgstr "" |
| 314 |
|
| 315 |
#. type: Plain text |
| 316 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 317 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 318 |
msgid "B<sched>(7) has a description of the Linux scheduling scheme." |
| 319 |
msgstr "" |
| 320 |
|
| 321 |
#. type: Plain text |
| 322 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 323 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 324 |
msgid "" |
| 325 |
"The affinity mask is a per-thread attribute that can be adjusted " |
| 326 |
"independently for each of the threads in a thread group. The value returned " |
| 327 |
"from a call to B<gettid>(2) can be passed in the argument I<pid>. " |
| 328 |
"Specifying I<pid> as 0 will set the attribute for the calling thread, and " |
| 329 |
"passing the value returned from a call to B<getpid>(2) will set the " |
| 330 |
"attribute for the main thread of the thread group. (If you are using the " |
| 331 |
"POSIX threads API, then use B<pthread_setaffinity_np>(3) instead of " |
| 332 |
"B<sched_setaffinity>().)" |
| 333 |
msgstr "" |
| 334 |
|
| 335 |
#. type: Plain text |
| 336 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 337 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 338 |
msgid "" |
| 339 |
"The I<isolcpus> boot option can be used to isolate one or more CPUs at boot " |
| 340 |
"time, so that no processes are scheduled onto those CPUs. Following the use " |
| 341 |
"of this boot option, the only way to schedule processes onto the isolated " |
| 342 |
"CPUs is via B<sched_setaffinity>() or the B<cpuset>(7) mechanism. For " |
| 343 |
"further information, see the kernel source file I<Documentation/admin-guide/" |
| 344 |
"kernel-parameters.txt>. As noted in that file, I<isolcpus> is the preferred " |
| 345 |
"mechanism of isolating CPUs (versus the alternative of manually setting the " |
| 346 |
"CPU affinity of all processes on the system)." |
| 347 |
msgstr "" |
| 348 |
|
| 349 |
#. type: Plain text |
| 350 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 351 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 352 |
msgid "" |
| 353 |
"A child created via B<fork>(2) inherits its parent's CPU affinity mask. " |
| 354 |
"The affinity mask is preserved across an B<execve>(2)." |
| 355 |
msgstr "" |
| 356 |
|
| 357 |
#. type: SS |
| 358 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 359 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 360 |
#, no-wrap |
| 361 |
msgid "C library/kernel differences" |
| 362 |
msgstr "" |
| 363 |
|
| 364 |
#. type: Plain text |
| 365 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 366 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 367 |
msgid "" |
| 368 |
"This manual page describes the glibc interface for the CPU affinity calls. " |
| 369 |
"The actual system call interface is slightly different, with the I<mask> " |
| 370 |
"being typed as I<unsigned long\\ *>, reflecting the fact that the underlying " |
| 371 |
"implementation of CPU sets is a simple bit mask." |
| 372 |
msgstr "" |
| 373 |
|
| 374 |
#. type: Plain text |
| 375 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 376 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 377 |
msgid "" |
| 378 |
"On success, the raw B<sched_getaffinity>() system call returns the number " |
| 379 |
"of bytes placed copied into the I<mask> buffer; this will be the minimum of " |
| 380 |
"I<cpusetsize> and the size (in bytes) of the I<cpumask_t> data type that is " |
| 381 |
"used internally by the kernel to represent the CPU set bit mask." |
| 382 |
msgstr "" |
| 383 |
|
| 384 |
#. type: SS |
| 385 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 386 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 387 |
#, no-wrap |
| 388 |
msgid "Handling systems with large CPU affinity masks" |
| 389 |
msgstr "" |
| 390 |
|
| 391 |
#. FIXME . See https://sourceware.org/bugzilla/show_bug.cgi?id=15630 |
| 392 |
#. and https://sourceware.org/ml/libc-alpha/2013-07/msg00288.html |
| 393 |
#. type: Plain text |
| 394 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 395 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 396 |
msgid "" |
| 397 |
"The underlying system calls (which represent CPU masks as bit masks of type " |
| 398 |
"I<unsigned long\\ *>) impose no restriction on the size of the CPU mask. " |
| 399 |
"However, the I<cpu_set_t> data type used by glibc has a fixed size of 128 " |
| 400 |
"bytes, meaning that the maximum CPU number that can be represented is 1023. " |
| 401 |
"If the kernel CPU affinity mask is larger than 1024, then calls of the form:" |
| 402 |
msgstr "" |
| 403 |
|
| 404 |
#. type: Plain text |
| 405 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 406 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 407 |
#, no-wrap |
| 408 |
msgid "sched_getaffinity(pid, sizeof(cpu_set_t), &mask);\n" |
| 409 |
msgstr "" |
| 410 |
|
| 411 |
#. type: Plain text |
| 412 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 413 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 414 |
msgid "" |
| 415 |
"fail with the error B<EINVAL>, the error produced by the underlying system " |
| 416 |
"call for the case where the I<mask> size specified in I<cpusetsize> is " |
| 417 |
"smaller than the size of the affinity mask used by the kernel. (Depending " |
| 418 |
"on the system CPU topology, the kernel affinity mask can be substantially " |
| 419 |
"larger than the number of active CPUs in the system.)" |
| 420 |
msgstr "" |
| 421 |
|
| 422 |
#. type: Plain text |
| 423 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 424 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 425 |
msgid "" |
| 426 |
"When working on systems with large kernel CPU affinity masks, one must " |
| 427 |
"dynamically allocate the I<mask> argument (see B<CPU_ALLOC>(3)). Currently, " |
| 428 |
"the only way to do this is by probing for the size of the required mask " |
| 429 |
"using B<sched_getaffinity>() calls with increasing mask sizes (until the " |
| 430 |
"call does not fail with the error B<EINVAL>)." |
| 431 |
msgstr "" |
| 432 |
|
| 433 |
#. type: Plain text |
| 434 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 435 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 436 |
msgid "" |
| 437 |
"Be aware that B<CPU_ALLOC>(3) may allocate a slightly larger CPU set than " |
| 438 |
"requested (because CPU sets are implemented as bit masks allocated in units " |
| 439 |
"of I<sizeof(long)>). Consequently, B<sched_getaffinity>() can set bits " |
| 440 |
"beyond the requested allocation size, because the kernel sees a few " |
| 441 |
"additional bits. Therefore, the caller should iterate over the bits in the " |
| 442 |
"returned set, counting those which are set, and stop upon reaching the value " |
| 443 |
"returned by B<CPU_COUNT>(3) (rather than iterating over the number of bits " |
| 444 |
"requested to be allocated)." |
| 445 |
msgstr "" |
| 446 |
|
| 447 |
#. type: SH |
| 448 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 449 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 450 |
#, no-wrap |
| 451 |
msgid "EXAMPLES" |
| 452 |
msgstr "" |
| 453 |
|
| 454 |
#. type: Plain text |
| 455 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 456 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 457 |
msgid "" |
| 458 |
"The program below creates a child process. The parent and child then each " |
| 459 |
"assign themselves to a specified CPU and execute identical loops that " |
| 460 |
"consume some CPU time. Before terminating, the parent waits for the child " |
| 461 |
"to complete. The program takes three command-line arguments: the CPU number " |
| 462 |
"for the parent, the CPU number for the child, and the number of loop " |
| 463 |
"iterations that both processes should perform." |
| 464 |
msgstr "" |
| 465 |
|
| 466 |
#. type: Plain text |
| 467 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 468 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 469 |
msgid "" |
| 470 |
"As the sample runs below demonstrate, the amount of real and CPU time " |
| 471 |
"consumed when running the program will depend on intra-core caching effects " |
| 472 |
"and whether the processes are using the same CPU." |
| 473 |
msgstr "" |
| 474 |
|
| 475 |
#. type: Plain text |
| 476 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 477 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 478 |
msgid "" |
| 479 |
"We first employ B<lscpu>(1) to determine that this (x86) system has two " |
| 480 |
"cores, each with two CPUs:" |
| 481 |
msgstr "" |
| 482 |
|
| 483 |
#. type: Plain text |
| 484 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 485 |
#: opensuse-tumbleweed |
| 486 |
#, no-wrap |
| 487 |
msgid "" |
| 488 |
"$B< lscpu | egrep -i \\[aq]core.*:|socket\\[aq]>;\n" |
| 489 |
"Thread(s) per core: 2\n" |
| 490 |
"Core(s) per socket: 2\n" |
| 491 |
"Socket(s): 1\n" |
| 492 |
msgstr "" |
| 493 |
|
| 494 |
#. type: Plain text |
| 495 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 496 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 497 |
msgid "" |
| 498 |
"We then time the operation of the example program for three cases: both " |
| 499 |
"processes running on the same CPU; both processes running on different CPUs " |
| 500 |
"on the same core; and both processes running on different CPUs on different " |
| 501 |
"cores." |
| 502 |
msgstr "" |
| 503 |
|
| 504 |
#. type: Plain text |
| 505 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 506 |
#: opensuse-tumbleweed |
| 507 |
#, no-wrap |
| 508 |
msgid "" |
| 509 |
"$B< time -p ./a.out 0 0 100000000>;\n" |
| 510 |
"real 14.75\n" |
| 511 |
"user 3.02\n" |
| 512 |
"sys 11.73\n" |
| 513 |
"$B< time -p ./a.out 0 1 100000000>;\n" |
| 514 |
"real 11.52\n" |
| 515 |
"user 3.98\n" |
| 516 |
"sys 19.06\n" |
| 517 |
"$B< time -p ./a.out 0 3 100000000>;\n" |
| 518 |
"real 7.89\n" |
| 519 |
"user 3.29\n" |
| 520 |
"sys 12.07\n" |
| 521 |
msgstr "" |
| 522 |
|
| 523 |
#. type: SS |
| 524 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 525 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 526 |
#, no-wrap |
| 527 |
msgid "Program source" |
| 528 |
msgstr "" |
| 529 |
|
| 530 |
#. type: Plain text |
| 531 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 532 |
#: opensuse-tumbleweed |
| 533 |
#, no-wrap |
| 534 |
msgid "" |
| 535 |
"#define _GNU_SOURCE\n" |
| 536 |
"#include E<lt>err.hE<gt>\n" |
| 537 |
"#include E<lt>sched.hE<gt>\n" |
| 538 |
"#include E<lt>stdio.hE<gt>\n" |
| 539 |
"#include E<lt>stdlib.hE<gt>\n" |
| 540 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 541 |
"#include E<lt>unistd.hE<gt>\n" |
| 542 |
"\\&\n" |
| 543 |
"int\n" |
| 544 |
"main(int argc, char *argv[])\n" |
| 545 |
"{\n" |
| 546 |
" int parentCPU, childCPU;\n" |
| 547 |
" cpu_set_t set;\n" |
| 548 |
" unsigned int nloops;\n" |
| 549 |
"\\&\n" |
| 550 |
" if (argc != 4) {\n" |
| 551 |
" fprintf(stderr, \"Usage: %s parent-cpu child-cpu num-loops\\[rs]n\",\n" |
| 552 |
" argv[0]);\n" |
| 553 |
" exit(EXIT_FAILURE);\n" |
| 554 |
" }\n" |
| 555 |
"\\&\n" |
| 556 |
" parentCPU = atoi(argv[1]);\n" |
| 557 |
" childCPU = atoi(argv[2]);\n" |
| 558 |
" nloops = atoi(argv[3]);\n" |
| 559 |
"\\&\n" |
| 560 |
" CPU_ZERO(&set);\n" |
| 561 |
"\\&\n" |
| 562 |
" switch (fork()) {\n" |
| 563 |
" case -1: /* Error */\n" |
| 564 |
" err(EXIT_FAILURE, \"fork\");\n" |
| 565 |
"\\&\n" |
| 566 |
" case 0: /* Child */\n" |
| 567 |
" CPU_SET(childCPU, &set);\n" |
| 568 |
"\\&\n" |
| 569 |
" if (sched_setaffinity(0, sizeof(set), &set) == -1)\n" |
| 570 |
" err(EXIT_FAILURE, \"sched_setaffinity\");\n" |
| 571 |
"\\&\n" |
| 572 |
" for (unsigned int j = 0; j E<lt> nloops; j++)\n" |
| 573 |
" getppid();\n" |
| 574 |
"\\&\n" |
| 575 |
" exit(EXIT_SUCCESS);\n" |
| 576 |
"\\&\n" |
| 577 |
" default: /* Parent */\n" |
| 578 |
" CPU_SET(parentCPU, &set);\n" |
| 579 |
"\\&\n" |
| 580 |
" if (sched_setaffinity(0, sizeof(set), &set) == -1)\n" |
| 581 |
" err(EXIT_FAILURE, \"sched_setaffinity\");\n" |
| 582 |
"\\&\n" |
| 583 |
" for (unsigned int j = 0; j E<lt> nloops; j++)\n" |
| 584 |
" getppid();\n" |
| 585 |
"\\&\n" |
| 586 |
" wait(NULL); /* Wait for child to terminate */\n" |
| 587 |
" exit(EXIT_SUCCESS);\n" |
| 588 |
" }\n" |
| 589 |
"}\n" |
| 590 |
msgstr "" |
| 591 |
|
| 592 |
#. SRC END |
| 593 |
#. type: SH |
| 594 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 595 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 596 |
#, no-wrap |
| 597 |
msgid "SEE ALSO" |
| 598 |
msgstr "" |
| 599 |
|
| 600 |
#. type: Plain text |
| 601 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 602 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 603 |
msgid "" |
| 604 |
"B<lscpu>(1), B<nproc>(1), B<taskset>(1), B<clone>(2), B<getcpu>(2), " |
| 605 |
"B<getpriority>(2), B<gettid>(2), B<nice>(2), B<sched_get_priority_max>(2), " |
| 606 |
"B<sched_get_priority_min>(2), B<sched_getscheduler>(2), " |
| 607 |
"B<sched_setscheduler>(2), B<setpriority>(2), B<CPU_SET>(3), " |
| 608 |
"B<get_nprocs>(3), B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), " |
| 609 |
"B<capabilities>(7), B<cpuset>(7), B<sched>(7), B<numactl>(8)" |
| 610 |
msgstr "" |
| 611 |
|
| 612 |
#. type: TH |
| 613 |
#: debian-trixie |
| 614 |
#, no-wrap |
| 615 |
msgid "2024-06-15" |
| 616 |
msgstr "" |
| 617 |
|
| 618 |
#. type: TH |
| 619 |
#: debian-trixie |
| 620 |
#, no-wrap |
| 621 |
msgid "Linux man-pages 6.9.1" |
| 622 |
msgstr "" |
| 623 |
|
| 624 |
#. type: Plain text |
| 625 |
#: debian-trixie |
| 626 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 627 |
msgstr "" |
| 628 |
|
| 629 |
#. type: Plain text |
| 630 |
#: debian-trixie fedora-44 fedora-rawhide |
| 631 |
#, no-wrap |
| 632 |
msgid "" |
| 633 |
"$ B<lscpu | egrep -i \\[aq]core.*:|socket\\[aq]>\n" |
| 634 |
"Thread(s) per core: 2\n" |
| 635 |
"Core(s) per socket: 2\n" |
| 636 |
"Socket(s): 1\n" |
| 637 |
msgstr "" |
| 638 |
|
| 639 |
#. type: Plain text |
| 640 |
#: debian-trixie fedora-44 fedora-rawhide |
| 641 |
#, no-wrap |
| 642 |
msgid "" |
| 643 |
"$ B<time -p ./a.out 0 0 100000000>\n" |
| 644 |
"real 14.75\n" |
| 645 |
"user 3.02\n" |
| 646 |
"sys 11.73\n" |
| 647 |
"$ B<time -p ./a.out 0 1 100000000>\n" |
| 648 |
"real 11.52\n" |
| 649 |
"user 3.98\n" |
| 650 |
"sys 19.06\n" |
| 651 |
"$ B<time -p ./a.out 0 3 100000000>\n" |
| 652 |
"real 7.89\n" |
| 653 |
"user 3.29\n" |
| 654 |
"sys 12.07\n" |
| 655 |
msgstr "" |
| 656 |
|
| 657 |
#. type: Plain text |
| 658 |
#: debian-trixie fedora-44 fedora-rawhide |
| 659 |
#, no-wrap |
| 660 |
msgid "" |
| 661 |
"#define _GNU_SOURCE\n" |
| 662 |
"#include E<lt>err.hE<gt>\n" |
| 663 |
"#include E<lt>sched.hE<gt>\n" |
| 664 |
"#include E<lt>stdio.hE<gt>\n" |
| 665 |
"#include E<lt>stdlib.hE<gt>\n" |
| 666 |
"#include E<lt>sys/wait.hE<gt>\n" |
| 667 |
"#include E<lt>unistd.hE<gt>\n" |
| 668 |
"\\&\n" |
| 669 |
"int\n" |
| 670 |
"main(int argc, char *argv[])\n" |
| 671 |
"{\n" |
| 672 |
" int parentCPU, childCPU;\n" |
| 673 |
" cpu_set_t set;\n" |
| 674 |
" unsigned int nloops;\n" |
| 675 |
"\\&\n" |
| 676 |
" if (argc != 4) {\n" |
| 677 |
" fprintf(stderr, \"Usage: %s parent-cpu child-cpu num-loops\\[rs]n\",\n" |
| 678 |
" argv[0]);\n" |
| 679 |
" exit(EXIT_FAILURE);\n" |
| 680 |
" }\n" |
| 681 |
"\\&\n" |
| 682 |
" parentCPU = atoi(argv[1]);\n" |
| 683 |
" childCPU = atoi(argv[2]);\n" |
| 684 |
" nloops = atoi(argv[3]);\n" |
| 685 |
"\\&\n" |
| 686 |
" CPU_ZERO(&set);\n" |
| 687 |
"\\&\n" |
| 688 |
" switch (fork()) {\n" |
| 689 |
" case -1: /* Error */\n" |
| 690 |
" err(EXIT_FAILURE, \"fork\");\n" |
| 691 |
"\\&\n" |
| 692 |
" case 0: /* Child */\n" |
| 693 |
" CPU_SET(childCPU, &set);\n" |
| 694 |
"\\&\n" |
| 695 |
" if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)\n" |
| 696 |
" err(EXIT_FAILURE, \"sched_setaffinity\");\n" |
| 697 |
"\\&\n" |
| 698 |
" for (unsigned int j = 0; j E<lt> nloops; j++)\n" |
| 699 |
" getppid();\n" |
| 700 |
"\\&\n" |
| 701 |
" exit(EXIT_SUCCESS);\n" |
| 702 |
"\\&\n" |
| 703 |
" default: /* Parent */\n" |
| 704 |
" CPU_SET(parentCPU, &set);\n" |
| 705 |
"\\&\n" |
| 706 |
" if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)\n" |
| 707 |
" err(EXIT_FAILURE, \"sched_setaffinity\");\n" |
| 708 |
"\\&\n" |
| 709 |
" for (unsigned int j = 0; j E<lt> nloops; j++)\n" |
| 710 |
" getppid();\n" |
| 711 |
"\\&\n" |
| 712 |
" wait(NULL); /* Wait for child to terminate */\n" |
| 713 |
" exit(EXIT_SUCCESS);\n" |
| 714 |
" }\n" |
| 715 |
"}\n" |
| 716 |
msgstr "" |
| 717 |
|
| 718 |
#. type: TH |
| 719 |
#: fedora-44 fedora-rawhide |
| 720 |
#, no-wrap |
| 721 |
msgid "2024-07-23" |
| 722 |
msgstr "" |
| 723 |
|
| 724 |
#. type: TH |
| 725 |
#: fedora-44 fedora-rawhide |
| 726 |
#, no-wrap |
| 727 |
msgid "Linux man-pages 6.13" |
| 728 |
msgstr "" |
| 729 |
|
| 730 |
#. type: TH |
| 731 |
#: mageia-cauldron |
| 732 |
#, no-wrap |
| 733 |
msgid "Linux man-pages 6.17" |
| 734 |
msgstr "" |
| 735 |
|
| 736 |
#. type: TH |
| 737 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 738 |
#, no-wrap |
| 739 |
msgid "Linux man-pages (unreleased)" |
| 740 |
msgstr "" |