i've noticed that the use of virtual memory on the iPad is a rather controversial topic on several online forums. in this article, i shall talk about what it's all about, and how it affects system performance. suffice to say, this technique currently only works on jailbroken iPads - however, i'm rather certain the same underlying technique will be used by apple when iOS4 is released sometime in november. until confirmation though, we can only hang tight.
to appreciate the import of virtual memory on modern systems thus, it is crucial to have at least a basic understanding of how a computer works beneath and behind the smoke and mirrors.
a short history lesson therefore...
a feature of the modern computer that is not widely known outside of the tech community is how the computer handles 'multitasking'. computers, well, when it all began anyway, started with only a processor core and memory chips that run in a synchronized fashion. that, incidentally, is how you get processors' clock speed, with the major processor makers going into a little arms race of their own for a couple of years.
back to clock speeds, a processor clocked a 1GHz would theoretically run at 1,000,000,000 cycles per second. that's an insane number of cycles squeezed into an incredibly short amount of time. any operation that your computer does will require a certain number of cycles to run. for example, you might choose to play an mp3, the computer will use a few cycles of processing to retrieve the file from disk, and after the file is read into the computer's memory (or Random Access Memory), the processor goes on to decode the mp3 file and uses an audio synthesizer to output the signal to your earphones or speakers.
now, obviously this is a very complicated process at the lowest levels, and techniques such as pipelining [wikipedia.org] can increase the perceived snappiness of the computer. using free cycles while the computer is fetching data from a data store, or even as it's running idle (remember, lots of cycles in a small time!) gives the user the impression of multitasking.
when we talk about system performance, however, the most obvious variables are:
the fantastic thing about apple's walled garden model of apps is the full control that they have over the product experience. in my opinion, i find that it's really true when they say they design the hardware, and then integrate it with their (approved) software to enhance the user experience. there's no question that their mantra _just works_. on the other hand, nobody ever said that there's only 1 way to skin a cat. some might even say apple's policies are rather high-handed.
i'm not going to go into a diatribe about how i feel about apple's policies. however, i will say that their engineers have created far superior hardware than their software will have you believe. for example, how many of us have used the iPad's onboard Safari browser and cringed everytime it reloads a page after we've come back from another tab?
the way Safari on the iPad works is that it runs almost exclusively on RAM, all 256mb and not very much of it at all (especially after taking into account the system programs running in the background, only 140mb or so is left for use). for this reason alone, the browser will clear it's memory store of any backgrounded tabs to free up memory to display the active tab. this certainly makes the browsing experience jarring when one returns to their previous tab...
naysayers will immediately point to other browsers who write their memory to a flash cache, and say that those do not suffer the same performance penalty. however, there is a universal method that works for Safari, and not just that app in particular. the fix will work for the whole system and generally make things snappier.
in the beginning of the post i mentioned how virtual memory is a controversial hot topic on the online forums. as it turns out, virtual memory (or VM for short) is also the way to improve performance on the iPad. the above example of the browsers actually give us a clue on how VM might work. essentially, when activated, iOS will create a swap file on disk (in our iPad case, the flash memory), and write the current contents of RAM to this swap file. it will then free up the RAM for use by the currently active app. when the "older" information is requested, iOS will load the data from the swap file back into RAM, providing rather transparent handover from the user's standpoint. a caveat though - i have to say "rather transparent" because there will be a barely noticeable <1 second lag as the system loads data into RAM. however, with VM activated, the user experience will be enhanced so much that it doesn't seem to matter.
on the dark side, people on the forums seem to be hung up about the longevity of NAND flash memory when VM is activated on their iPads. there are a vocal few in the community who argues that NAND flash has a limited life-span (true) and that using this method will significantly shorten that life-span (controversial).
to elaborate, NAND memory _does_ have a limited life-span, in the range of 100,000 write cycles for the older models to 1,000,000 cycles for the newer models. as of writing, their is no definitive answer as to which chips are installed in the iPads. however, there are mitigating factors arguing that the VM method will not significantly shorten the iPad's life.
firstly, activating VM will create swap files on the flash disk. these files are written and overwritten once or twice or even 3 times a day with heavy usage. 100,000 / 3 per day = 3300+ days = more than 9 years of usage time. supposing the newer NAND chips with a rated 1,000,000 cycles were installed, we would have more than 90 years of usage on the device. i'm not even sure if i'll be alive in 90 years' time.. haha.
secondly, there is this technique among flash disk makers to mitigate the limited write cycles of their products. this is known as wear levelling [wikipedia.org]. in essence, writing is spread across the available "free space" on the flash disk to ensure that no single sector is being heavily used. whether this method has been implemented by apple or not is unclear, but given the range of flash based products that apple produces (think iPad, iPhone, iPod touch, iPod shuffle, iPod nano and so on..), it wouldn't be overly optimistic that they are rather sophisticated in their handling of flash memory.
hence, i do believe that activating virtual memory is a worthy and low-risk hack for your iPad. i shall be posting up step by step instructions for doing so shortly. as usual, if you liked this post, comment or give us a shout out!
*i shall not talk more about how the type of RAM affects system performance, for that's a study into the history of RAM, and delves into far too much detail for this article. however, do leave a comment if you're keen and i'll see if i can't point you in the right direction :-)
to appreciate the import of virtual memory on modern systems thus, it is crucial to have at least a basic understanding of how a computer works beneath and behind the smoke and mirrors.
a short history lesson therefore...
a feature of the modern computer that is not widely known outside of the tech community is how the computer handles 'multitasking'. computers, well, when it all began anyway, started with only a processor core and memory chips that run in a synchronized fashion. that, incidentally, is how you get processors' clock speed, with the major processor makers going into a little arms race of their own for a couple of years.
back to clock speeds, a processor clocked a 1GHz would theoretically run at 1,000,000,000 cycles per second. that's an insane number of cycles squeezed into an incredibly short amount of time. any operation that your computer does will require a certain number of cycles to run. for example, you might choose to play an mp3, the computer will use a few cycles of processing to retrieve the file from disk, and after the file is read into the computer's memory (or Random Access Memory), the processor goes on to decode the mp3 file and uses an audio synthesizer to output the signal to your earphones or speakers.
now, obviously this is a very complicated process at the lowest levels, and techniques such as pipelining [wikipedia.org] can increase the perceived snappiness of the computer. using free cycles while the computer is fetching data from a data store, or even as it's running idle (remember, lots of cycles in a small time!) gives the user the impression of multitasking.
when we talk about system performance, however, the most obvious variables are:
- processor speed (clock speed)
- amount and type of RAM
- access time of the storage media
the fantastic thing about apple's walled garden model of apps is the full control that they have over the product experience. in my opinion, i find that it's really true when they say they design the hardware, and then integrate it with their (approved) software to enhance the user experience. there's no question that their mantra _just works_. on the other hand, nobody ever said that there's only 1 way to skin a cat. some might even say apple's policies are rather high-handed.
i'm not going to go into a diatribe about how i feel about apple's policies. however, i will say that their engineers have created far superior hardware than their software will have you believe. for example, how many of us have used the iPad's onboard Safari browser and cringed everytime it reloads a page after we've come back from another tab?
the way Safari on the iPad works is that it runs almost exclusively on RAM, all 256mb and not very much of it at all (especially after taking into account the system programs running in the background, only 140mb or so is left for use). for this reason alone, the browser will clear it's memory store of any backgrounded tabs to free up memory to display the active tab. this certainly makes the browsing experience jarring when one returns to their previous tab...
naysayers will immediately point to other browsers who write their memory to a flash cache, and say that those do not suffer the same performance penalty. however, there is a universal method that works for Safari, and not just that app in particular. the fix will work for the whole system and generally make things snappier.
in the beginning of the post i mentioned how virtual memory is a controversial hot topic on the online forums. as it turns out, virtual memory (or VM for short) is also the way to improve performance on the iPad. the above example of the browsers actually give us a clue on how VM might work. essentially, when activated, iOS will create a swap file on disk (in our iPad case, the flash memory), and write the current contents of RAM to this swap file. it will then free up the RAM for use by the currently active app. when the "older" information is requested, iOS will load the data from the swap file back into RAM, providing rather transparent handover from the user's standpoint. a caveat though - i have to say "rather transparent" because there will be a barely noticeable <1 second lag as the system loads data into RAM. however, with VM activated, the user experience will be enhanced so much that it doesn't seem to matter.
on the dark side, people on the forums seem to be hung up about the longevity of NAND flash memory when VM is activated on their iPads. there are a vocal few in the community who argues that NAND flash has a limited life-span (true) and that using this method will significantly shorten that life-span (controversial).
to elaborate, NAND memory _does_ have a limited life-span, in the range of 100,000 write cycles for the older models to 1,000,000 cycles for the newer models. as of writing, their is no definitive answer as to which chips are installed in the iPads. however, there are mitigating factors arguing that the VM method will not significantly shorten the iPad's life.
firstly, activating VM will create swap files on the flash disk. these files are written and overwritten once or twice or even 3 times a day with heavy usage. 100,000 / 3 per day = 3300+ days = more than 9 years of usage time. supposing the newer NAND chips with a rated 1,000,000 cycles were installed, we would have more than 90 years of usage on the device. i'm not even sure if i'll be alive in 90 years' time.. haha.
secondly, there is this technique among flash disk makers to mitigate the limited write cycles of their products. this is known as wear levelling [wikipedia.org]. in essence, writing is spread across the available "free space" on the flash disk to ensure that no single sector is being heavily used. whether this method has been implemented by apple or not is unclear, but given the range of flash based products that apple produces (think iPad, iPhone, iPod touch, iPod shuffle, iPod nano and so on..), it wouldn't be overly optimistic that they are rather sophisticated in their handling of flash memory.
hence, i do believe that activating virtual memory is a worthy and low-risk hack for your iPad. i shall be posting up step by step instructions for doing so shortly. as usual, if you liked this post, comment or give us a shout out!
*i shall not talk more about how the type of RAM affects system performance, for that's a study into the history of RAM, and delves into far too much detail for this article. however, do leave a comment if you're keen and i'll see if i can't point you in the right direction :-)
Comments
Post a Comment