I often do some scientific calculations with Python code. These are very CPU and at times RAM hungry. Usually my Xubuntu 16.04 GUI freezes for periods of time during such a task, which means I can't really use the machine during those calculations which is of course annoying. Mouse movement is stopped or extremely slowed down, as well as any other action. Is there a way to avoid this?
1 Answers
Do you have disk activity during those times? (ie. being ram hungry as you describe, it's page faulting regularly and needing to go to swap)
You may find altering the swappiness value may improve things a little (ie. the level of which it uses swap; normally 60(%). I'd suggest reducing to 10-30 but adjust for your hardware & requirements).
If you're not familiar with swappiness; refer
How do I configure swappiness?
The gui slows when the system is overloaded; esp. if the page needed by a gui process isn't there (page-fault) and it has to wait for it to be reloaded from swap.
Yes you can have swap on ssd; pro's & con's (mostly pros in your case). I'd suggest a better choice maybe offloading/moving your python-processing to another [remote] machine you control from your device, or if you don't have another box, try and limit yourself to terminal apps that use less resources whilst your large python job(s) are running. The python job is your problem, not Xubuntu

- 30,396
-
1You were right. I resolved the issue by using less CPU cores during computation, thus avoiding swapping. It sped up the whole process, even though the swap file was already located on my machine's SSD, as
lsblk
showed. – smcs Jul 18 '18 at 08:15
Mem
close to 100% andSwp
showed up to 20G/31.9G. So this means physical memory is 'overflowing' onto the hard drive, which could slow down the GUI? I have a conventional HD and an SSD--could I make swapping use the SSD to speed things up? – smcs Jul 06 '18 at 13:32