submitted 18 hours ago* (last edited 18 hours ago) by to c/linux@lemmy.world
 

I'm a programmer by trade with twenty years of experience, having first used Linux in 2004 (iirc), and I thought I knew the game pretty well. There are CPU-bound tasks, memory-bound tasks, network-bound tasks, and disk-bound tasks. I'm doing async programming and it's working fine, offloading i/o to the kernel while my app is doing cpu stuff. Except, I'm now using a laptop with 8 GB of memory and Linux Mint-Cinammon on HDD as my main machine, and somehow shit is constantly in the swap and waits for the disk. Right now I'm moving a Windows partition, I have quit everything except four Firefox tabs, Emacs, and Double Commander — and I still think I might kill myself before the ordeal is over. The entire system is completely and totally fucked. Barely anything moves, nothing responds in any kind of a timely fashion. Emacs freezes when typing, with two open buffers. Audio playback stutters. VPN is nonresponsive. I closed all the hundreds of buffers in Emacs, I set the priority and io priority of Gparted to the minimum, and the other apps to the max. I set swappiness to zero, and turned off the swap altogether with swapoff. All of this barely helps. I'm drunk right now, and still this affair bugs me beyond measure. I could maybe deal with this as a one-time thing if swapping and disk i/o weren't incapacitating the system every day.

Is Linux kernel so ridiculously single-threaded that any i/o cripples the entire thing? Or is something tuned horribly wrong in Mint by default? Can I unfuck this somehow? I live close to a river, I can't take this much temptation.

you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 16 hours ago (2 children)

The Linux kernel (and windows btw) often lock threads to the completion of reads or writes to disk. When your primary drive is a spinner and you saturate it's bandwidth with a long-running copy (your from windows copy) you take those normally short processes and add the latency penalty of a thrashing disk to every lock.

Yes you can fix this by moving the entire kernel and operating system into ram at boot, but with 8gb you probably don't want to do that, especially when a couple of Firefox tabs will fill that up pretty quickly.

The solution is drop the gui, load the os into ram and disable logging, or be patient, and don't expect any modern operating system to hold up when you are running long copies against a high-latency root disk.

  • source
  • hideshow 2 child comments
  • [–] [S] -5 points 16 hours ago* (last edited 15 hours ago) (1 child)

    Yeah, I do know that i/o is mostly single-threaded (except maybe for when multiple disks are involved, not sure about that). However I'm baffled as to why the entire system is impaired when i/o is done. It feels like the kernel has only one thread doing anything, and the userspace apps are constantly tugging on the kernel for some reason. It makes no sense. Userspace apps should be running on the CPU without the kernel's involvement, but for some reason they don't. I have eight cores (with hyperthreading) doing fuckall when the disk is busy.

  • source
  • parent
  • hideshow 1 child comment