New Linux OS Scheduler Reduces Lag by Keeping Light Work on Fewer CPU Cores

 Nest OS Scheduler
Nest OS Scheduler

According to a report by Phoronix, a new CPU scheduler is being developed for Linux operating systems that decreases system latency and improves performance in low load scenarios. The new scheduler, known as Nest, is designed to focus lightly threaded workloads towards as few processing cores as possible, in an effort to keep boost frequencies at their peak for as long as possible.

This strategy is a large departure from most CPU schedulers being used today, which are optimized for multi-core saturation. This strategy is great in theory, since it evenly distributes as many tasks to as many cores as possible, but due to architectural deficiencies in modern CPUs, this strategy isn't the best use of CPU resources.

Clock speed behavior on modern microchip processors has changed drastically over the past decade. In the past, all you really had was a single base clock speed the chip would  for low, medium and heavy applications, along with a very simple turbo boosting algorithm that would engage a specific frequency in medium or heavy workloads as long as there was enough thermal and power headroom to spare.

But nowadays, CPU frequency behavior has become a lot more complicated, with chips being able to run at a near infinite amount of differing clock speeds, along with several tiers of sleep states the cores can enter when underutilized.

These new features are amazing at increasing efficiency, but they can introduce unwanted lag that is caused by delays in CPU clock speed adjustments. A CPU can't wake from sleep instantaneously; it needs some time to wake up.

Nest address these problems by prioritizing the most recently used cores in a system that are already running at peak turbo clock speeds from previous work done. This way, Nest can keep feeding work to cores that are already operating at their highest operating clocks to counter any clock speed adjustment delays and keep CPU performance as high as possible.

Nest does this by "nesting" cores that it knows are actively being used or recently were used, and believes these cores will be useful in the near future. Nest does this with two clusters it calls the "Primary Nest" and the "Reserve Nest". The Primary Nest is where all the active cores and predicted active cores reside for light to moderate workloads. The Reserve Nest is where all the unused cores are located.

Nest will actively add or remove cores from the Primary Nest when necessary and focus all light and moderate work onto these cores. It will even ping some of the cores to ensure they don't go to sleep if there is a slight moment of downtime. Nest will only bring cores residing in the reserve nest into the primary nest if the active cores are cannot do the work efficiently or at all.

Basically, Nest is smart enough to know which cores it thinks will be useful in the near future, for future work. Nest has been reportedly provide a 10% to 2x performance increase in light to moderate workloads in AMD desktops, AMD servers and Intel servers.

It will be interesting to see how this scheduler plays out on Linux. Technically Windows 10 and 11 has some of this behavior for AMD Ryzen processors, where the task scheduler will prioritize specific physical cores for lightly threaded workloads. But Nest appears to be a far more advanced and capable scheduler, that acts much more fluidly and isn't limited by the properties of specific cores.

Hopefully we'll get to see it in action one day soon in a real world Linux system, but for now, it is still being researched.