Why does mouse and keyboard freeze when Linux swaps

Ale*_*lev 6 linux performance swap

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.

o11*_*11c 2

为了运行程序,它必须位于 RAM 中。在颠簸期间,所有程序都会从​​ RAM 中换出,然后必须再次换入才能运行。

此外,对于许多(但不是全部)输入事件,X11 服务器和窗口管理器之间必须存在往返,并且窗口管理器可能会尝试触发其他事件。由于您没有任何 RAM,因此如果窗口管理器写入管道或套接字,则必须阻塞,直到接收进程从中读取数据。

  • 您真的是说“所有”程序都被换掉了吗?据我所知,在任何现代操作系统设计中,只有最近最少使用的页面才会被换出。您所说的有关窗口管理器和处理事件的内容是有道理的,但在我看来,鼠标光标路径上的无响应应用程序不太可能捕获鼠标光标并阻止其进一步移动。 (3认同)