64-bit chips are too much for a smartphone! Really?

After today’s Apple event, the press is on ebullition to report on it. One journalist at Gigaom has written an article on “Apple’s new 64-bit chip is too much for a smartphone, but great for a MacBook“, he explicitly stated the following:

For chip nerds the idea of 64-bit chip inside a smartphone is overkill. The benefits of a 64-bit chip is that is can take advantage of 4 gigabytes of addressable RAM, but most smartphones are barely hitting 2 or 3 GB of RAM today.

First, let’s correct his statement and then I will tell why I think that a smartphone can benefit from 64-bit chip.

The author could have better stated that 64-bit chips allows the OS to support more than 4 gigabytes of physical memory (RAM) and even if a smartphone does not have or need more than a couple of GB, this progress will provide developers with increased addressable memory space for their apps which can be beneficiary in terms of performance and security.

Explanation

32-bit CPU have in theory a physical address space of 32 bit only, so they can address up to 232 Bytes of memory which amounts to 4 GB. However, many factors could make this limit varry, the OS could use part of this address space for other purpose (like memory for drivers), hence the well-known 3 GB barrier on Intel/AMD x86 architecture.

There are many solution to overcome this limit, such as having a larger physical address space (e.g. 36- or 48-bit). If there is OS support, then it usually means that a 32-bit system can have more than 4 GB of memory. One should understand that we are talking about the physical address space, or in layman’s terms the amount of RAM supported. However, a process uses a virtual address space which is set in stone to 32-bit, so a process even on such extended 32-bit architecture cannot address more than 4 GB (or even less as mentioned above).

Therefore, 64-bit adds the ability to address more than 4 GB of RAM for the entire system and per process1. But do we need today more than 4 GB of memory usable by a single process?

Yes!

For what I know on x86_64 (and I would presume on ARM 64-bit too) is that the virtual address space for a process is much increased. On Linux, you have 256 TB for each process (128 TB user and 128 TB kernel space). That’s a lot of possible accessible memory and it serves different purpose:

  • Security: A process code is loaded by the OS in memory prior to execution, if an attacker knows where in memory it is (e.g. the position is fix), it is easier for him to perform a hack and make your code execute instructions it was not designed to support. So OS have developed several techniques to help randomise the address space to mitigate such attacks. But if you have an address space of 4 GB or of 256 TB, this mitigation does not provide the same effect.
  • Performance: apart a few mathematical algorithm that can be improved by using 64-bit registers (like cryptographic ones), another performance improvement is in the handling of huge files using memory mapped file (quick introduction about memory mapped files). Basically, 64-bit applications benefits from the added address space when accessing files bigger than a few GB (e.g. videos, etc.).

So with today usage (which could include Full-HD videos, file encryption, added process security) I do see benefits of switching to a 64-bit architecture. And who knows what would be our requirements tomorrow?

Finally, the journalist was thinking that Apple A7 CPU would fit better in an Macbook Air. I again disagree, unless Macbook Airs sporting this CPU runs iOS. Even if OS X could run on ARM, all the current applications would need to be ported to ARM before they can be used. Apple allowed PowerPC applications to run on Intel CPU using Rosetta, because Intel CPUs were powerful enough to cope with the extra translation layer without too much performance loss (although this is debatable for some applications). But I do not think that the Apple A7 is powerful enough to run an x86 translation layer and have application still usable.

Conclusion

I therefore think that even with today usage one could already have scenarios where he could benefits from 64-bit architecture (huge files like videos, encryption, better process security), and in the coming years this is going to be more and more a reality.

I think than the journalist should have better questioned the usefulness of 8-cores CPU than 64-bit CPU on a smartphone. The only usage2 I could think for such a power CPU would be in a hybrid phone, one that could be plugged to a screen and keyboard/mouse set and that would transform itself into a computer.

Disclaimer: I am a software engineer, not an electronic or chip engineer, my views are therefore biased by software and I know just enough about CPU architecture to properly developed and maintained software, that’s it. I own an iPad and an Android phone.

  1. One should notice that the physical address space on modern x86_64 architecture is not 64 bit, it is at least 48-bit, so up to 256 TB. And the virtual address space is equally “limited”. I do not know the limits for the ARM 64-bit architecture (if Apple is using this architecture).
  2. I think the idea of mixing energy-efficient cores with powerful ones is great. But common, a quad-core (2 A15 core + 2 A7 core) would have been more than enough, even for games! Developers should really optimise their code instead of relying on ever faster monster CPUs…