Skip Navigation

Is there a way to keep Linux responsive when at ~100% CPU usage?

One big difference that I've noticed between Windows and Linux is that Windows does a much better job ensuring that the system stays responsive even under heavy load.

For instance, I often need to compile Rust code. Anyone who writes Rust knows that the Rust compiler is very good at using all your cores and all the CPU time it can get its hands on (which is good, you want it to compile as fast as possible after all). But that means that for a time while my Rust code is compiling, I will be maxing out all my CPU cores at 100% usage.

When this happens on Windows, I've never really noticed. I can use my web browser or my code editor just fine while the code compiles, so I've never really thought about it.

However, on Linux when all my cores reach 100%, I start to notice it. It seems like every window I have open starts to lag and I get stuttering as the programs struggle to get a little bit of CPU that's left. My web browser starts lagging with whole seconds of no response and my editor behaves the same. Even my KDE Plasma desktop environment starts lagging.

I suppose Windows must be doing something clever to somehow prioritize user-facing GUI applications even in the face of extreme CPU starvation, while Linux doesn't seem to do a similar thing (or doesn't do it as well).

Is this an inherent problem of Linux at the moment or can I do something to improve this? I'm on Kubuntu 24.04 if it matters. Also, I don't believe it is a memory or I/O problem as my memory is sitting at around 60% usage when it happens with 0% swap usage, while my CPU sits at basically 100% on all cores. I've also tried disabling swap and it doesn't seem to make a difference.

EDIT: Tried nice -n +19, still lags my other programs.

EDIT 2: Tried installing the Liquorix kernel, which is supposedly better for this kinda thing. I dunno if it's placebo but stuff feels a bit snappier now? My mouse feels more responsive. Again, dunno if it's placebo. But anyways, I tried compiling again and it still lags my other stuff.

124

You're viewing a single thread.

124 comments
  • Linux defaults are optimized for performance and not for desktop usability.

    • If that is the case, Linux will never be a viable desktop OS alternative.

      Either that needs to change or distributions targeting desktop needs to do it. Maybe we need desktop and server variants of Linux. It kinda makes sense as these use cases are quite different.

      EDIT: I'm curious about the down votes. Do people really believe that it benefits Linux to deprioritise user experience in this way? Do you really think Linux will become an actual commonplace OS if it keeps focusing on "performance" instead of UX?

      • Linux is already a popular and viable desktop OS - for its target audience.

        The downvote comes from you implying people cannot dev in Linux when its the platform of choice for this workload.

        Now surely the user experience could be polished, but advanced users are at this point used to the workflow, and basic ones will stick to Windows out of inertia no matter what. Therefore the incentive for improving this kind of things is extremely low.

        • That might be the case, but that makes me sad though. That implies that Linux is only targeting technical people who are willing to tinker with all these things themselves.

          I would personally want Linux to be broader than that. I'd want it to be the option for everyone - free computing shouldn't be limited to technical people, it should be provided to all.

      • "Desktop" Linux exists in this state for decades. Who cares? Maybe we won't have consumer desktops as a niche soon. Existing users are fine with that. Don't say you are waiting that Linux will become "a viable desktop OS alternative" in next few years.

        It's also not about "desktop and sever variants". Desktop Linux is either conservative or underresourced. Conservatives will told you that you are wrong and there is no issue. And they are major Linux zealots. For the other side someone need to write code and do system design, and there are not many of people for that. So, it's better not to expect a solution anytime soon, if you are not planning to work on it by yourself.

        • “Desktop” Linux exists in this state for decades. Who cares?

          I mean, I'd like to think a lot of people care? I think a lot of people in this community would love if Linux was more widespread and less niche.

          Maybe we won’t have consumer desktops as a niche soon. Existing users are fine with that.

          "Existing users" are not fine with that (I am also an existing user). But even if they were, that is not an attitude that will make Linux into a Windows/macOS competitor.

          Don’t say you are waiting that Linux will become “a viable desktop OS alternative” in next few years.

          We need a viable desktop alternative today or very soon more now than ever before. Microsoft is tightening the noose on Windows 11 and introducing more and more enshittification. Apple also announced AI partnerships recently. We need alternatives.

          It is not good for society for operating systems to be boiled down to two mega-corporate choices. An OS is not something that can be easily made - this is not a space that a competitor can quickly enter and shake things up. If we don't push MS/Apple off the throne, Linux will stay niche forever and society will suffer.

          • Society will suffer anyway. It doesn't make solutions magically appear. You only said why you want it, but not how to do it. To transform GNU/Linux distros into a viable desktop OS is not an easy task, especially when people don't have a consensus about what it should be.

            • Of course - I have actually lately been thinking if Linux is suffering from it's "decentralisation". There are so many distributions, all with their own structure and teams behind them. On the one hand, this is great, more choice is almost universally good.

              However, on the other hand, it leads to a much more fractured movement. Imagine instead of there being 100 or whatever distros, there were maybe just like... 5 or 10 or something. I feel like it'd be easier to rally under fewer flags to consolidate effort and avoid double work. But it's just a thought I've had lately.

              • Distros are unnecessary entities and don't improve anything here. What is needed it's separation of the system and the apps, where apps are provided in sandboxed bundles with permissions. It will solve a lot of issues, not only one you have mentioned. And try to imagine amount of years needed for understanding or explaining importance of this to the GNU/Linux community. A viable desktop OS, huh?

You've viewed 124 comments.