When I start memory-intense processes (such as git gc in a repository with huge files), Linux starts becoming unresponsive after some time, at first the UI lags a little, then the mouse stops moving and then the keyboard stops working too. The interesting thing about it that it apparantly also disables the SysRQ keys for some reason, I can't use SysRQ-Kill or SysRQ-Reboot anymore in that state.

What can I do in order to prevent this situation from happening, maybe like letting Linux kill processes that use too much memory.

  • 1
    You can't access to the terminal with ctrl-alt-F3? – Sepahrad Salour Dec 6 '13 at 17:07
  • @SepahradSalour: No, neither that. (And it would be strange if that worked but SysRQ not.) – heinrich5991 Dec 6 '13 at 17:09
  • And the CPU usage remains normal? – goldilocks Dec 6 '13 at 17:33
  • @heinrich: Many times this happened for me but ctrl-alt-F3 work well in centos... – Sepahrad Salour Dec 6 '13 at 17:53

Linux by default already has a "OOM killer". When your system runs out of memory, the kernel will kill a process, trying to chooses whichever one is the culprit in the system running out of memory. However, if your system is configured to use a swap, this won't happen until it runs out of both main memory and swap space. If your swap device is slow (e.g. a spinning hard disk) this might not happen until well after your system has slowed to a crawl and become unresponsive.

You can try turning off your swap, and see if this results in your memory-hungry process being killed before your system becomes unusable.


Assuming you have an adquate amount of memory and all of your hardware is working as intended, try messing around with ulimit.


Actually, I think if you wait a bit, your keystrokes would work, but short of that, you might run jobs like this at a much lower priority.

As root, before the memory utilization spikes, renice the priority. It is important to remember that positive number have a lower priority, and negative one higher. See how things work if you renice the process to +10 or even +20.

  • 1
    He is talking about MEMORY usage not CPU which you have mentioned nice command! – Sepahrad Salour Dec 6 '13 at 17:56

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.