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.

  • SorteKanin@feddit.dkOP
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    6 months ago

    So I just tried using nice -n +19 and it still lags my browser and my UI. So that’s not even a good workaround.

    • BB_C
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      Is your browser Firefox?
      What kind of storage devices do you have? NVMe?
      Did you check with tools like iotop to see if something is going on IO wise?

      You assumed that the problem is caused by the CPU being utilized at 100%.
      This may not be the case.

      A lot of us don’t run a DE at all. I myself use Awesome WM.
      For non-tilers, Openbox with some toolbar would be the ideal setup.

      I mention this because we (non-DE users) would have no experience with some funky stuff like a possible KDE indexer running in the background killing IO performance and thrashing buffered/cached memory.

      Also, some of us run firefox with eatmydata because we hate fsync 🤨

      Neither KDE nor Gnome is peak Desktop Linux experience.
      Ubuntu and its flavors is not peak distro experience either.

      If you want to try Desktop Linux for real, you will need to dip your toes a little bit deeper.

      • SorteKanin@feddit.dkOP
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        6 months ago

        Yes Firefox, yes NVMe. No, there is no IO happening and again, sitting at relatively low memory usage. I was not running anything else than the compiler, my editor and Firefox. I’m fairly confident the CPU usage is the culprit as memory usage is not severely affected and disk usage by the compiler should be pretty minimal (and I don’t see how disk usage would make Firefox slow if there’s still plenty of RAM available).

        Neither KDE nor Gnome is peak Desktop Linux experience. Ubuntu and its flavors is not peak distro experience either.

        If you want to try Desktop Linux for real, you will need to dip your toes a little bit deeper.

        I’ve heard much of the opposite - KDE is touted as an easy-to-use desktop and Ubuntu is largely a popular “just works” distro. And honestly that has been my primary experience. Mostly everything works, but there are some hiccups here and there like the problem I posted about in this thread.

        What alternative would you suggest?

        • BB_C
          link
          fedilink
          arrow-up
          1
          arrow-down
          3
          ·
          6 months ago

          What alternative would you suggest?

          A, rolling release first, distro (e.g. Arch or Void) with no DE installed.
          But you’re probably not ready for that.
          For me, a terminal and Firefox are the only GUI apps really needed. mpv too if it counts.
          But I’m someone who has been running Arch+AwesomeWM for ~15 years ago (been using Arch for even longer). So I probably can’t meaningfully put myself in new users’ shoes.