Every so often--usually when I have lots of programs open--my laptop starts doing what I think is an endless swap operation. The hard drive writes and reads like crazy, and the mouse stops being responsive. When I try to see what process is causing this, I press Ctrl+Alt+F1 to get a terminal, but I can't even log in because the operation is taking up all system resources, and letters appear several seconds, or even minutes, after I press the keys. Usually I have to hard-reboot the computer, which I know is bad for the HD, since it's spinning like crazy when I power it down.
So I can't identify what process is causing this, because I can't even open a terminal to run
top when it happens.
I have 2G of memory, and a 5G swap partition.
What could be causing this, and how do I fix it?