this post was submitted on 16 Jan 2024
178 points (97.8% liked)

Linux

48153 readers
658 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
top 18 comments
sorted by: hot top controversial new old
[–] [email protected] 46 points 10 months ago* (last edited 10 months ago) (3 children)

For those getting excited, It doesn't "boost" gaming performance. It prioritizes the game over the background process (in this case, a kernel being compiled.)

Schedulers aren't magic. As pointed out in the comments of the linked article, there are other ways of doing this. The more interesting tech here is being able to choose between schedulers under specific workloads, which is very nice IMO.

[–] [email protected] 8 points 10 months ago

Schedulers aren't magic, but there are mores ways to skin a cat.

I think process schedulers is a neat and easy compartmentalisation of a concept in itself that adheres to the UNIX philosophy. Hey, if new hardware with new instructions come, that old scheduler might not be the best fit anymore (x86 went big.LITTLE), or say you got a particular workload that works well with a specific scheduler - the latter possibly being a myth.

I've rarely met anyone who didn't stick to their distributions of choice. This is because recompiling the kernels all the time is a pain and crufting up your system with third party repos is just added complexity.

Jokes on you though, that's why I run NixOS. it's all cruft and complexity lol

nix store gc go brr (on schedule of course).

[–] [email protected] 4 points 10 months ago

So it is more or less like changing to -1 or something.

[–] [email protected] 1 points 10 months ago* (last edited 10 months ago)

Sounds like exactly what you would want for games and interactive apps

[–] [email protected] 32 points 10 months ago* (last edited 10 months ago) (1 children)

I looked into this a bit more and here is the summary: This is meant to show off a candidate kernel feature that allows for running different schedulers in userland.

Task scheduling has become much more complex as CPUs have grown in size and have had new developments in architecture, so the need to develop more complex and robust schedulers is steadily rising.

The kernel feature is meant to lower the barrier of entry for anyone who wants to try getting into schedulers, as well as enable quicker development iteration, by removing the need to completely recompile the linux kernel every time you want to test your code.

Read more at the main project's github: https://github.com/sched-ext/scx

[–] [email protected] 5 points 10 months ago (2 children)

Not quite running in userspace. To the best of my own understanding:

The new kernel feature is to allow writing schedulers in eBPF, a "language" the kernel runs in kernelspace that is heavily restricted.

For example, all eBPF programs must complete in bounded time, and the kernel's static checker must be able to verify that before the program can even begin executing. eBPF is a rare language that is not touring complete.

"For scx_simple, suspending the scheduler process doesn't affect scheduling behavior because all that the userspace component does is print statistics. This doesn't hold for all schedulers."

So, it may be that eBPF also makes it easier to write a truly userspace scheduler, but that's not the primary purpose, and it's not what is being done with scx_simple.

https://lwn.net/Articles/909095/ for more about (e)BPF.

[–] [email protected] 3 points 10 months ago

Thank you for the correction! Reading up on eBPF is fascinating.

Additional resource that adds to your secondary point that this is more than just allowing schedulers to be run in userland: https://github.com/sched-ext/scx/blob/main/scheds/c/README.md

[–] [email protected] 1 points 10 months ago

Is eBPF dependently typed?

[–] [email protected] 27 points 10 months ago (1 children)

Wow, that's a huge difference. I wonder if it's just a niche case that fixes Terraria specifically, it would be nice to see more benchmarks on other games.

[–] [email protected] 17 points 10 months ago* (last edited 10 months ago)

I didn't watch it all. (OK, didn't realize it was only a minute. I basically saw everything).

But I wonder if it's simpler than that, and it's just doing a better job prioritizing the game. Presumably there's a reason they're doing it while running a heavy background process.

This obviously still has value if it's the case, and is a big part of the point of a scheduler, but the headline implied (to me) that it's a general performance improvement, and the video doesn't demonstrate that.

[–] [email protected] 22 points 10 months ago (1 children)

If this is in user space, does this mean we can switch schedulers on the fly? Put it in game mode when gaming, power saving mode when on battery, etc?

[–] [email protected] 8 points 10 months ago (2 children)

Does a scheduler impact power draw? Maybe you're confusing this for a CPU governor perhaps?

And yes, the underlying tech here is user-configurable schedulers. Very neat.

[–] [email protected] 10 points 10 months ago

I'm not 100% sure, I just assumed you could affect power use too with different schedulers. Either way, even if that's not the case, being able to change the performance characteristics based on what you want to do on the fly is pretty exciting in its own right.

[–] [email protected] 6 points 10 months ago* (last edited 10 months ago)

The short answer is: It does.

A governor guides the hardware regarding power consumption, but it is still dependent on workload and utilisation. Moreover, modern p-state drivers may use utilisation to control voltage and frequency scaling and there is also a scheduler driven governor in Linux (actually it's the most recent one iirc).

[–] [email protected] 8 points 10 months ago (1 children)

Now if only gccrs would mature soon!

LLVM-based is fine for most case, but I bet a lot of people would want to stick with gcc for compiling the kernel.

[–] [email protected] 3 points 10 months ago (1 children)

For that usecase rustc_codegen_gcc works too and is much more likely to be mature soon.

[–] [email protected] 0 points 10 months ago (1 children)

It seems to still require LLVM, tho

[–] [email protected] 1 points 10 months ago

What makes you think that? The whole point of it is to create a rustc backend that uses libgccjit instead of LLVM.