[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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1732492935660840.png (17 KB, 712x652)
17 KB
17 KB PNG
previous: >>108557703

#define __NR_getpriority            140
#define __NR_setpriority 141

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

tl;dr:
manage your process's scheduling priority

was conflicted about if i should merge tomorrow's syscalls into this one, but i figured i would keep these separate and do all of the sched_* ones at once
you'll probably want to see also https://man7.org/linux/man-pages/man2/nice.2.html and https://man7.org/linux/man-pages/man7/sched.7.html
nice values are just... bizarre
       The range of the nice value varies across UNIX systems.  On modern
Linux, the range is -20 (high priority) to +19 (low priority). On
some other systems, the range is -20..20. Very early Linux
kernels (before Linux 2.0) had the range -infinity..15.

i'm sure there's some sort of logic to it, and i could certainly look it up, but maybe someone else already knows and would like to share? let's get some audience participation going!
of interest (to me, at least) is:
   C library/kernel differences
The getpriority system call returns nice values translated to the
range 40..1, since a negative return value would be interpreted as
an error. The glibc wrapper function for getpriority() translates
the value back according to the formula unice = 20 - knice (thus,
the 40..1 range returned by the kernel corresponds to the range
-20..19 as seen by user space).

so why even have them be negative in the first place...? goodness!
tomorrow i will probably try to jump start some scheduling algorithm discussion in the thread, but feel free to share your thoughts now, if you have any
the only other thing that really stands out to me today is probably the bugs section:
       According to POSIX, the nice value is a per-process setting.
However, under the current Linux/NPTL implementation of POSIX
threads, the nice value is a per-thread attribute: different
threads in the same process can have different nice values.
Portable applications should avoid relying on the Linux behavior,
which may be made standards conformant in the future.

i do think a per-thread implementation is the sane choice, though

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/
>>
why do you still make these threads?
don't @ me btw, I already closed the thread.
>>
>>108565194
i'm like halfway through and want to finish what i started! i probably won't end up doing something like this again in the future, though, because yes it's pretty clear that most people on /g/ aren't interested in this sort of thing. but it's been a nice source of consistency in my life so far this year
>>
>>108565210
you probably would have had better luck posting these 8-10 years ago
>>
File: 1775699042922261.png (23 KB, 923x842)
23 KB
23 KB PNG
do syscalls for all operating systems after you finish linucks
>>
>>108565569
do it yourself
>>
>>108565569
i'll probably do some arm ones, nonstandard ones, and maaaaybe bsd after all that
>>
>>108565168
SysCall senpai, when did you become smart?
>>
>>108565168
FWIW, the POSIX manpage says that the values should be in the range
 [0, {NZERO} * 2 - 1] 
, so this may be a strange, Linux-specific thing.
>>
>>108565168
A "nice" value is literally supposed to denote the literal "niceness" of the selected entity. A high "nice" value means that it will let others run first (i.e. being extra nice), a low or negative value means that it will demand runtime before anyone else (i.e. being quite egotistical).

>autists trying to be funny again
>>
>>108566677
midway through my first job, when i got assigned to some tough tasks that no one else had the time to do. i had to buckle down and handle it. i actually did quite poorly in college. i'm much better in the corporate world, i guess
>>
>>108566821
I don't get it, explain.
>>
>>108565168
>that pic
Do you need a hug, syscall-anon?
>>
>>108566960
... letting others run first is nice.
>>
>>108567000
Yes, I understand english. I obviously meant that you should explain your """"quote""""""
Who are were you quoting btw?
>>
>>108567009
My inner voice.
>>
i could do with a hug
>>
>>108566965
hugs are very nice, so i would almost never turn down an offer like that :>
>>
>>108566876
You are pretty cool senpai.
>>
>>108567164
uwah,,,,, thank u anon that's nice of u to say



[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.