Lets say you have an application launched and minimized for a long time (30 min). When you restore the application you will notice that it’s slow and sometimes “not responding” for a few seconds. It’s annoying, really!
I face this problem when I run applications that use too much memory (such as Adobe Photoshop, Visual Studio or….).
Basically, modern operating systems attempt to make the applications that are running as fast as possible – but they also allow many applications to run at once, more than all of their memory could fit into the RAM at once. So when the OS sees that a running application needs to allocate a new page of memory, but RAM is full of pages already, it kicks one of the pages (preferring ones that have not been used in a while) to the hard disk, into a file called the page file.
When the application for which that page of memory belonged to attempts to access it, this is called a ‘page fault’ – the OS detects the page is not in RAM but on disk, and has to read it into RAM before execution continues. This is relatively slow since reading from the hard disk is slower than reading from RAM. If an application hasn’t been running for some time, it’s conceivable that ALL of its pages have been paged out to RAM – and so it will be slow until it stops hitting page faults.
1) Write an application to behave asynchronously – if a thread while doing things that trigger page faults, the program is also sensitive to other threads.
2) Deliberately touching each page of your memory to keep everything paged (Only recommended if your application is so important that it deserves to occupy RAM all the time, even when not used!)
3) Do not minimize your application, send it out of the screen (ex: set position -1000), and make a timer to activate the window each 10 minutes.
4) Buy more RAM.