The secrets of demand paging
In our discussion on the NAM95 post of Al Pavangkanan PseudoFinn made a remark about demand paging which made me realize many of us are still unclear about what it actually does. So here is a short blot on my conception of it. Note that I don't work for Nokia, I am unfamiliar with their exact implementation. However the term 'demand paging' is a well known technique in the field of Computer Science and Engineering and the general outline here should suffice to validate what I write here. Any Nokia experts are welcome to comment and improve on this.
PseudoFinn more or less stated that not only improves demand paging the available amount of RAM for applications (TRUE), it increases the speed too (FALSE, but with some remarks).
Demand paging
Demand paging has been around since the early Unix days when memory per megabyte was far more expensive than hard-disk memory per MB. It is nothing more than having a virtual amount of memory larger than your RAM allows. Only the part of virtual memory currently accessed is loaded into the RAM (128MB in your case, 64MB in my case). Unused memory is swapped to disk clearing real RAM for running more or larger applications. It allows to use the expensive but fast RAM more efficient while storing currently unused memory on a slow but cheaply and much larger sized disk.
RAM has very high access speeds, disk are in general very slow. For example:
- N95 RAM: 32-bit*333MHz = 1.3GB/s
- Access to
the firmware ROM is in general slower than RAM access.
- Disk speed on the N95 is timed around 2 MB/s.
All memory access has to be checked wether it is resident or stored on disk and handled as such. Demand paging does is not an improvement of you RAM handling. There is no speed increase. In fact it actually slows down memory access. The disk swapping creates noticable delays and slows the general performance. Start Nokia search on you N95 and see the huge delay caused by swapping. Delays that were not there before demand paging.
Demand paging allows however to 'run' a nearly unlimited size of inactive OS-modules and inactive programs. These inactive programs need thus not be closed and switching between them means loading the virtual memory part at low diskspeed to run them. This is often faster and certainly more practical than restarting them. The number of simultaneous active programs is however still limited by your real RAM size. As such you can not have Nokia Maps simultaneously active while taking a picture. Both programs can however both be 'open' at the same time and one of them running. As such you still need to close sometimes programs on the N95-1 because there are two many active programs running. Not all programs support the demand paging properly and lack a proper sleep/inactive mode.
The good part about demand paging is that the bigger free RAM for applications does wonders on the N95-1 that was pretty cramped for running even 1 major application. Memory fragmentation and unreleased memory chunks can 'eat' free RAM and make the N95 unstable causing an auto boot or requiring a manual reset. Demand paging improves hugely on both these problems. Making the phone more stable and reliable. Wootness indeed.
N95-3
The complaints about the slowness of the N95-3 can not be caused by the lack of demand paging. Even without demand paging the free RAM (not virtual memory) for running active application exceeds that of the free RAM of the N95-1 with demand paging. Nokia did not consider demand paging very essential for any other phone than the half brained N95-1 that has only 64MB! The difference between V20 and V12 firware for the N95-1 was not only demand paging. More free RAM can make a computer run smoother, though in the N95 NAM case this is most unlikely the case. Demand paging increased the free RAM in a freshly booted N95-1 to about 27 MB while pre-"demand paging" firmwares had 18-20 MB free RAM. With the N95 NAM having 128MB RAM, It has significant more free RAM than a halfbrained N95-1.
No, there were also certain power and speed improvements implemented in the firmware. On average the N95-1 V20 firmware is 25% more power efficient. And note that demand pages (disk writes and reads) are actually an additional power drain besides the earlier indicated speed reduction! It think the V20 power and speed optimisations are the things required for the N95NAM to improve it's speed.
Summary
Demand paging does de facto not increase the speed of a computer. In fact it slows it down. It does however allow the free RAM to be used more efficiently when running large amounts of inactive tasks. Demand paging allows for faster switching between them. Running out of RAM for active tasks and forcing a computer system to continuous swap between disk stored virtual memory pages to run an application can actually make a computer dead slow and locked up. The slowness of the N95NAM is unexplained but I would hazard to guess that it has to do with the USA 3G changes or it is the missing speed and power improvements that were implemented in the V20 firmware for the N95-1. No doubt they will occure at the next firmware update, since the slowness is definitely a valid point for discontent.
Nokia has currently several new projects on track to be integrated in new firmware, location tagging working with Maps, wonderful Maps 2.0 itself, Nokia search, flash support in the webbrowser and of course the coming n-gage. All of these are to be implemented in firmware at some time. However remember how long it took Nokia to coff up demand paging for the N95-1. At least 6 months. Expect at least 3-4 months for the N95 NAM. Development and proper testing takes time.
Comments
http://www.symbian.com/symbianos/demandpaging/index.html
Any case it will safe some power too if certain functions that are not always used during an application´s runtime are not loaded. However the program will pause/slow down for module loading when accessing functions of yet unloaded parts. Still I doubt if all speed up is to be purely attributed to ´demand paging´. Some optimization has been done for sure.
Demand paging is a curse and a blessing for us N95-1 owners. I would have preferred a real hardware RAM upgrade ;-) But it will do until my next upgrade. For now I patiently await for our next firmware upgrade. Please let there be S/MIME.
In my N95, gizmo is broken, internet radio is broken, sportstracker is broken. Gizmo calls to my N95 actually crash my phone! After next firmware upgrade, no more quack designed application on my phone!