I Put an LLM Inside the Linux Kernel Scheduler. Here's What Happened.
A few weeks ago, I did something that probably shouldn't work. I replaced the CPU scheduling algorithm in my Linux kernel with calls to an AI model. As on-device LLM inference capabilities grow, I ...

Source: DEV Community
A few weeks ago, I did something that probably shouldn't work. I replaced the CPU scheduling algorithm in my Linux kernel with calls to an AI model. As on-device LLM inference capabilities grow, I am curious about its potential as a CPU scheduler. Maybe in the future, tweaking a laptop's performance is a matter of adjusting the system prompt 🤷♂️ What Is a CPU Scheduler? CPU Scheduler is an operating system component that decides which task or process gets to use the CPU at a particular time. Linux's default scheduler is called CFS (Completely Fair Scheduler). It's an algorithm that tries to give every process a fair share of CPU time, weighted by priority. It makes decisions in microseconds, fully algorithmic. The Idea Two things that made this feel worth trying. First, sched_ext landed in Linux 6.12. It's a framework that lets you write custom CPU schedulers as eBPF programs and load them into a running kernel without patching or rebooting. If you want to dive deeper into how sched_