0

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
    Do you have disk activity during those times? (ie. being ram hungry as you describe, it's page faulting regularly) 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 askubuntu.com/questions/103915/how-do-i-configure-swappiness – guiverc Jul 6 '18 at 12:48
  • That could be it. I ran a calculation and watched htop. All cores close to 100%, Mem close to 100% and Swp 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 6 '18 at 13:32
  • 1
    Of course your gui slows when the system is overloaded; esp. if the page it needs 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 though you should offload/move your python-processing to another [remote] machine you control from there, or if you don't have another box, try and limit yourself to terminal apps that use less resources whilst its running. The python job is your problem, not Xubuntu. – guiverc Jul 6 '18 at 22:43
  • 1
    @guiverc: It looks like your suspicion was confirmed which makes a base for an answer. Do you want the honours? – David Foerster Jul 7 '18 at 17:48
  • 1
    My guess is yes (more ram would help). Eventually you hit a point of diminishing returns (the page lookups to see if page is in memory or swapped-out, taking as long than grabbing straight from disk is reached but that seldom is). Without knowing your python app I can't know, or using faster swap (ssd you mentioned; but using ssd that way usually shortens ssd life, but that may still be cheaper than ram [cost/benefit]), as may be using another language (cost of re-write versus time saved), or faster box - the best for you only you can decide. Swap use isn't bad, too much though is :) – guiverc Jul 9 '18 at 10:10
1

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

  • 1
    You 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 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.