# change scheduler for responsiveness?

## rwst

when the (desktop) system froze because I had given the Java application not enough memory and swapping happened, I wondered why this still happens on a modern system. would a different i/o scheduler help to let me switch via keyboard to another virtual desktop and e.g. work with a terminal there? I simply don't want swapping to take 100% of the system's ressources. (and no, I have enough memory, this is a principles question about schedulers)

----------

## eccerr0r

If you have enough resources (RAM) it should never swap...

The problem is that the computer does not know what parts of memory contains the user interface until it's too late.  Once any of these memory blocks get swapped out, it's game over, your UI will become very poor.  No I/O scheduler or CPU scheduler will help because the other competing application is also code, so they have the same priority - unless there's a priority system for each thread.

Best is if there's a way to tell the OS which memory chunks are user-interface thus being high priority, and which are "best effort" compute jobs...

This is complicated if the compute job and the user interface is the same application, and the application will need to tell which memory blocks are which.  The UI will likely need to be in different threads...

But the application programmer tends to be the lazy one and do not want to distinguish which memory blocks should contain UI and which one are best effort compute.  Blame the application programmer not the OS.  OS is doing the best it can with limited information.

----------

