I have noticed that under Linux, when there is heavy swapping, the mouse cursor freezes, and even CapsLock or Ctrl+Alt+F1 don't work. The system uses the deadline I/O scheduler but this should not matter at all since mouse and keyboard I/O should not compete with disk I/O. During the swapping the CPU is pretty idle, I can see it by the audible fan activity. I have read others complain about this as well. For comparison, even Windows XP does not freeze mouse and keyboard, and you can actually do something to kill the offending process. Under Linux you need to have ssh server, otherwise you can only sit and wait till the OOM killer kills the app.
1 Answer
In order to run a program, it must be in RAM. During thrashing, all programs get swapped out of RAM and then have to be swapped in again before they can run.
Additionally, for many (but not all) input events, there must be a round trip between your X11 server and your window manager, and the window manager may try to trigger additional events. And since you don't have any RAM, if the window manager writes to a pipe or socket, that has to block until the receiving process reads from it.
-
3Do you really mean that 'all' programs are swapped out? AFAIK in any modern OS design only the least recently used pages are swapped out. What you say about the window manager and processing events makes sense, but seems to me quite unlikely that a non-responding application on the path of the mouse cursor would trap the mouse cursor and prevent it from travelling further.Alexander Vassilev– Alexander Vassilev2014-10-20 15:05:32 +00:00Commented Oct 20, 2014 at 15:05
-
@AlexanderVassilev +1. I'll admit that swapping can be slow, but definitely not as slow as moving 4, 8, 16GB of RAM to disk. Besides, you don't need to have the same amounts of RAM and swap. The kernel uses a finer strategy and decides which processes can be swapped out (based on their activity).John WH Smith– John WH Smith2014-10-20 16:22:52 +00:00Commented Oct 20, 2014 at 16:22
-
@AlexanderVassilev The whole idea of the thrashing problem is that even running processes have been swapped out.o11c– o11c2014-10-21 05:07:46 +00:00Commented Oct 21, 2014 at 5:07