Adam Beckett Nov 26, 2024 @ 1:43pm
2025 will be the year of 'write your own CPU scheduler'?
I am slowly catching up with the Linux developer conferences (too many).

One great talk was by Jonathan Corbet at the Open Source Summit in Japan last month. He gave a brief keynote on what to expect from the Linux Kernel in 2025.

One topic he mentioned was the development of sched-ext.

To this day, the common rule was "There can be only one CPU scheduler" (no matter which Operating System. Many developers in recent years questioned this approach.

This meant that no matter in which environment the CPUs are used (DataCenter Clusters or Single User Desktop PCs), they all had the same CPU scheduler, working, doing its thing.

But, why not have an optimized CPU scheduler, if you know, you will use it on a particular set of hardware, with narrowly defined software running, for a specific user case ... like "playing video games"?

Good news!

It is possible and it is worked on right now.

A new scheduling class called sched_ext was introduced in the latest Linux Kernels and one of them is being actively developed for Gaming systems (specifically the Steam Deck).

scx_lavd

What this ideally does is maximise the response time of game related threads and reduce - or even eliminate completely - the non-gaming tasks from your OS.

Unlike the Windows false promise of 'Gaming Mode' THIS - CPU scheduler based approach - truly can be exactly that.

I still have a few Windows OS Gaming PCs running, because of some games which are just too much hassle to make the run on Linux/Proton. Whenever I install a fresh Windows, one of the first tasks is to open 'services.msc' and disable all the gazillion new services Microsoft is implementing in each new update of Win 10/11.

Even though, not all of them are running actively, they are there, just waiting for some MS app to trigger them?

The moment you allow your Windows PC to go online, you are no longer in control of your own PC. Especially, since Win 11 was in development, Microsoft cut all the illusion, that 'Administrator' means anything other than you being a 'co-pilot', while MS is the real one, flying.

I am glad, that the Linux Kernel community is still so active and people are pushing new things and features. Stuff, which comes from the mindset of "how can we make things more useful?" instead of "how can we push our shareholder value?"

A few links for the interested:

Keynote: Kernel Report - Jonathan Corbet
https://youtu.be/uvXPOV-oqso?feature=shared&t=749

sched-ext Project:
https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git/

sched-ext Tutorial:
https://wiki.cachyos.org/configuration/sched-ext/

Using sched_ext to improve frame rates on the SteamDeck:
Powerpoint Slides - Talk by Changwoo Min (PDF)
https://lpc.events/event/18/contributions/1713/attachments/1425/3058/scx_lavd-lpc-mc-24.pdf
< >
Showing 1-2 of 2 comments
A&A Nov 26, 2024 @ 2:24pm 
So basicly priority scheduling?
Last edited by A&A; Nov 26, 2024 @ 2:25pm
Adam Beckett Nov 26, 2024 @ 2:50pm 
Nope. Not at all. See here:

https://www.geeksforgeeks.org/program-for-priority-cpu-scheduling-set-1/


With 'priority scheduling' you are still just managing the full mess that it can - and will - cause.

A custom scheduler is more akin to a custom build, leaner Linux kernel. You shape it for your specific purposes and avoid whole sections of unnecessary processes, threads, loops, chains altogether.

With a custom written CPU scheduler, you can just tell it to do the '5 things' you want, instead dragging the 100 things, it should not have to deal with for your environment. Reducing complexity. Increasing efficiency.
< >
Showing 1-2 of 2 comments
Per page: 1530 50

Date Posted: Nov 26, 2024 @ 1:43pm
Posts: 2