May 18 2009
… or, indeed, on a system with modern 64bit-capable processor(s) is it better to run the 32bit or 64bit version of any given OS?
Firstly, a technical aside to help frame the issues:
What does it mean to run in 64bit mode, how does this help, and how is Intel’s x86 architecture different?
I’ll start this article with a quick look at a processor which most people won’t have heard of, and an OS that almost no-one will ever have used. Bear with me 😉
The MIPS range of RISC microprocessors was launched in 1985 with the R2000, and went 64bit in 1991 with the R4000. These processors were used in many embedded and workstation environments, powering the Nintendo 64, the Sony Playstation, Playstation 2, and PSP in addition to SGI workstations and supercomputers. These days, it is one of the most popular CPUs for use in gadgets and mobile devices due to it’s flexibility and low power requirements. Read more about it here.
IRIX is SGI’s workstation and supercomputer OS. Release 6.0 in 1994 first added support for 64bit processors running in 64bit mode. The interesting thing is how SGI approached this. Being a well-designed RISC architecture (and in common with many other processor architectures, such as Power(PC) and SPARC) running a MIPS CPU in 64bit mode only results in additional range for (long) integer and floating-point variables, and access to more than 4GiB of address space. However, this is at the cost of decreased system performance since pointers are twice the width. Because of this often dubious benefit, IRIX consists of a 64bit kernel alongside a predominantly 32bit userland. This results in the system being entirely 64bit capable, but retaining the efficiency of 32bit code wherever possible. And, for this architecture, this is exactly the right way to do things.
We’ll now turn our attention back to PCs powered by Intel’s x86 architecture. In this case, there are a number of complications to muddy the waters. Primarily, the x86 ISA is severely register-starved, with only 8 registers of 16 in total being available for general-purpose usage (although a common option is to forego the ability to debug code by using the stack-pointer register as an additional general-purpose register). Compare this to the 32 general-purpose registers available on MIPS processors from inception, or the 128 general-purpose registers of the Intel Itanium/IA64. The x86-64/AMD64 ISA redresses this somewhat by increasing the number of general-purpose registers to 16, allowing applications to run considerably more efficiently – balancing much of the negative effect of the wider data transfers.
In addition to this, the vast majority of people are not aware of the impact of enabling No-Execute protection in their OS: The NX bit is stored as bit 63 of a 64bit-wide page-table. This means that PAE-mode must be enabled on 32bit processors to expand their page-table width to the 64bits required in order that this bit be accessible. 32bit x86 processors in PAE mode always run significantly slower than in non-PAE mode, as memory lookups have to go through several additional layers of translation and on-processor caches lose half their capacity. Since Windows Server 2003 and Windows XP SP2, Windows automatically enables NX (named “DEP”, or “Data Execution Prevention”) on all hardware that is capable of supporting it.
Finally, bear in mind that all PCI devices (including PCIe and AGP peripherals) are mapped on top of main memory from 4GiB downwards on 32bit systems, rendering any overlaid physical memory inaccessible. As long as machines with more than 2GB memory weren’t common this was not an issue – but nowadays you can purchase graphics cards with 2Gb memory on-board: in this case, a 4GB system with one of these cards installed would have less than 1.9GB available for actual usage. A system with two such cards would likely not even boot.
Enough with the background, should I run a 64bit OS or not?
On 32bit x86 architectures, you’ll probably already be living with the limitations of 64bit mode without realising it: Whilst running in 64bit mode does slow memory access and computations involving wide values, the efficiencies of having more registers and simplified paths to memory (with NX still enabled) actually make 64bit operation a preferable choice. The fact that PCI memory remapping means that a full 4Gb of memory can be accessed on a 4Gb system is the coup de grâce – I’d suggest that anyone with a reasonable modern system should be running a 64bit OS, if at all possible.
(And yes, 32bit applications continue to work transparently and without modification on 64bit OS, in 32bit-emulation mode)