Thread #108565168
HomeIndexCatalogAll ThreadsNew ThreadReply
H
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/
+Showing all 41 replies.
>>
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
>>
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
>>
>>108565210
I really like these threads even if I don't interact with them. It think a lot of people would appreciate more series like these even if they have nothing to add
>>
>>108567420
I'm planning on creating a thread series for the accepted Rust RFCs.
thoughts?
>>
>>108567475
I don't really program in rust because it feels like a very "enterprise" language designed to be like nu cpp or java, worked on by horses of people that are unfamiliar with 90% of the codebase

however I would still read your threads and it might convince me to try harder at it
>>
>>108567492
>horses
hordes. I abhor enterprise codebases which is what I do at work, so I wouldn't want to engage in that in my free time.

I'm more interested in one-man or small team projects like zig because they end up being much more opinionated and sovl. Hell even Go feels more opinionated
>>
>>108565168
What's the point of this tranime spam?
>>
>>108567508
>I like edgy projects
>>
>>108567492
Rust solves issues only stage n programmers have: https://www.youtube.com/watch?v=xt1KNDmOYqA
>>
>>108567475
>I'm planning on creating a thread series for the accepted Rust RFCs.
Sounds like blackmail!
Turning the syscalls into fine tuned hand optimized RISC-V assembly would be more interesting and also probably engage more regulars.
>>
>>108568068
>Turning the syscalls into fine tuned hand optimized RISC-V assembly
How is that supposed to work? You'll still require a mode switch, you can't inline them (doesn't matter if mono or micro)
>>
>>108568085
>You'll still require a mode switch
Not sure what you mean, but someone has started this:
https://www.phoronix.com/news/Linux-7.1-RISC-V-strnlen
>>
>>108568212
it's not the syscall wrapper which is slow, but the mode switch (from userland into kernel mode)
>>
>>108567897
>stage n programmer
tf does that mean
>>108567528
well yes edgy stuff is what shapes fields, safe things are boring and only pad until the next big thing
>>
>>108568212
>strnlen
That's not a mode switch. Fuck, I can implement that one in the finest SIMD without a single mode switch: https://lock.cmpxchg8b.com/zenbleed.html
>>
>>108568265
Fuck, meant to reply to >>108568248.
I blame the gin.

Anyway, go watch the video, I'm busy farming sources.
>>
>>108568265
super interesting article. thanks for sharing
>>
>>108568085 >>108568265
The mode switch has a cost but that doesn't stop anyone from optimizing the rest.
Many syscalls are handled by the C libraries, do all of those also require a mode switch?
>>
>>108568926
>Many syscalls are handled by the C libraries,
That's ... literally not how this shit works
>>
>>108566876
nice
>>
File: file.png (43.7 KB)
43.7 KB
43.7 KB PNG
>>108568068
RISC-meme is for sissies
>>108565168
The return value of 40 confused me for a bit.
>so why even have them be negative in the first place...? goodness!
This is what happens when you shoehorn a POSIX standard onto a different interface
>>
>>108570543
i rather like ARM. i'd like for RISC-V to be as good one day
>>
>>108565168
Hugs with Pomni
>>
>>108572140
isn't she just so precious?

Reply to Thread #108565168


Supported: JPG, PNG, GIF, WebP, WebM, MP4, MP3 (max 4MB)