[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1708185469009524.jpg (100 KB, 500x500)
100 KB JPG
previous: >>108744281

#define __NR_sched_setaffinity        203
#define __NR_sched_getaffinity 204

https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html

tl;dr:
manage your thread's allowed CPU(s)

pretty neat, and not overly complicated. see also https://man7.org/linux/man-pages/man7/cpuset.7.html
another API which is pretty annoying where you have to allocate, query, reallocate, etc. until you don't get EINVAL. take special care to ensure you don't overflow when they round up!
it's got a nice example program. i always really appreciate manpages that do that
anyway, yeah. good syscall. actually has quite a lot of real world uses, and though the API is kind of gross, it could certainly be worse. overall, i'm quite happy with it i'd say

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
>>
>>108751329
syscalls r gay
>>
>>108751329
syscall more like gaycall
>>
>>108751576
what did she mean by this
>>
>>108751329
syscall more like siscall
>>
god I hope I'll never have NUMA cores
>>
bump for the syscall sis.
>>
so what I make this syscall and the system is going to accommodate the max number of threads to be used for a program in specific? Or controls the max number of threads for the while system unit
>>
>>108755188
say you have CPUs numbed 0-3
with this syscall, you can restrict your process to any subset of those CPUs
so you could, in theory, have two different worker threads that you might want to pin to separate CPUs (say, 0 and 1, or even 0-1 and 2-3) so that they don't interfere with each other's cache
>>
>>108751329
Syscall more like snailcat
>>
>>108755544
thank you, you are very kind.
>>
File: 1773539519661813.jpg (31 KB, 477x474)
31 KB JPG
>>108756314
i like helping anons to learn more about syscalls and the linux kernel! it makes me happy to see them interested in the discussion
>>
>>108755544
>so that they don't interfere with each other's cache
What about systemd, and gnome, and the other bloat that keep running in the background on a Linux system?

Those will keep thrashing the cache. While two cpu bound threads will already span different cpu if the system is not under pressure, no need for these useless syscalls at all.
>>
>>108756791
i don't use gnome, and systemd shouldn't be doing much
but there are plenty of circumstances where you might use this on non consumer hardware, or in other circumstances where you would expect to have more control over the processes running
>>
>>108751329
I think this is メアリーさん.
Sex with メアリーさん.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.