Friday, 26 July 2013

Rebooting: Speeds up Windows, slows down Linux

Regular readers will know that I am reiplophobic, enjoying (not suffering from!) a pathological dislike of rebooting computers. This morning, I rebooted Traal, and I'm seeing a significant improvement in performance; the CPU is running quieter, switching applications is faster, etc, etc. Traal runs Windows XP. The opposite is true of my Linux computers; immediately after a reboot, they tend to run a little slower than immediately before. Why?

I don't have hard data on it, but I suspect that the problem mainly comes from memory management, especially the swap file. Traal has only 2GB of physical memory, so he'll invariably be using the swapper; all it takes is one good video and stuff will be pushed into the page file. As time goes on, it seems that Windows has problems with memory fragmentation, with consequent performance degradation - until it took so long to page Firefox back in that Windows asked if it should end the process. Linux seems to suffer much less from this; on a system with the same amount of physical memory (no fair comparing against Sikorsky's 16GB), the page file will be used, but with far less slow-down.

Also, Linux has some rather impressive caching facilities. So long as you have the RAM available, it'll use it to improve performance; and if an application pushes other things into the page file and they don't get called back, their RAM becomes available for caching again. Searching your entire disk for a file with a particular name may take a long time... the first time. Do it again immediately, and it's way faster, because the directory entries are all cached. Rebooting blows all that away, plus it forces applications to be reinitialized (which is slower than recalling them from the page file).

Giving either OS more memory will improve performance. And with the price of a gig of memory as low as it currently is, there's not a lot of reason to skimp. But the difference between Linux and Windows becomes stark when physical RAM is exhausted and the swap file is used. Microsoft would do well to get out of the OS/kernel business and just make a UI for a Unix-like OS (which they would still call "Windows").

1 comment:

Stephen Angelico said...

The only thing is, (let's face it) programs developed for Windows will not run 100% the same on a UNIX-based kernel with Wine (or other packages that do similar jobs, not VMs).