[In the fourth Microsoft-sponsored article on Gamasutra's XNA-themed microsite, XNA Developer Connection's Walbourn discusses the rise of 64-bit computing and gaming on Windows, explaining the technical specifics and programming advantages of 64-bit.]
“640K is more memory than anyone will ever need”
This famous, oft-quoted phrase -- and variations of it -- is routinely attributed to Bill Gates, founder and chairman of Microsoft Corporation. For the record, Gates flatly denies ever having said it. In fact, he has said the opposite.1 Still, it persists in technical urban legend as a warning against underestimating the pace of PC evolution. We’ve come a long way since the days of the Intel 8088 processor with its 8-bit data bus addressing one MB (the upper 384 KB of addressing space was reserved for expansion cards, leaving 640 KB for physical memory).
The laptop I’m using to write this article has 6,500 times more RAM than that. In fact, my mobile phone, my digital camera, my DVR, and a dozen other electronic devices I interact with every day have far more than 640 KB of memory. Of course, at the time of this alleged quote, in the early days of the PC industry, many home computers had 64 KB or less.
Like all engineering design efforts, PCs reflect a series of trade-offs. Designers make compromises to make the device easier to build and cheaper to mass produce. These compromises often provide some room for future growth, but often fall short of the true pace of innovation to minimize the impact on existing applications.
The PC’s greatest strength is its great weakness: the relentless drive for innovation and backward compatibility. It is a testament to the hard work of generations of engineers that we’ve had a long chain of backward-compatible products that bridge a 16-bit processor running at 4.77 MHz with 16 KB of RAM, CGA 4-bit color graphics, and 16 KB of Video RAM (VRAM) to the modern 64-bit processor running four or more CPUs at ~3 GHz, 4+ GB of RAM, one or more Direct3D10 class GPUs, and nearly a GB of VRAM.
We are now a few years into another major transition. Actually, two major processor transitions are happening at the time same. First, there is the move from single-core to multi-core processors. Modern gaming consoles like Microsoft Xbox 360® have already pushed game developers to embrace, if reluctantly, the transition from single-threaded to multi-threaded gaming. There is still a long way to go before we embrace the multi-core designs currently under development in the PC industry. At the same time, there is a second transition: these new multi-core processors appearing in our PCs are also 64-bit x64 processors.
The core of the memory limitation for a 32-bit processor comes from basic binary math:
232 = 4,294,967,296 bytes or 4 GB
This means a 32-bit processor can address only 4 GB worth of memory. However, 4 GB is extremely optimistic. Not every single address can be used for physical RAM. Much like the original IBM PC could address 640 KB of RAM, while the upper 384 KB was reserved for expansion cards, modern devices also need to use some of that addressing space. At boot time, the BIOS allocates addresses from the 0xc0000000 (3 GB) to 0Xffffffff (4 GB) range for installed devices.
Many of these devices are integrated into the motherboard. The mapping system is more flexible than it once was. Even so, everything from your audio device to your video card to the network interface needs to take away some of those address locations for its own purposes. This leaves the balance available for physical RAM. Because of this, the actual amount of physical memory accessible is something like 3 GB, 3.33 GB, or 3.5 GB, even when 4 GB or more physical RAM is installed.2 The amount of available physical RAM diminishes when you add more devices such as multiple video cards in a SLI® or Crossfire™ setup.
There have been clever solutions proposed to resolve this problem, such as Intel’s Physical Address Extensions, originally introduced in the Intel Pentium® Pro and also supported by AMD’s Athalon™ processors.3 PAE enables you to use 36-bit physical memory addressing, while you continue to use 32-bit addresses for the virtual memory system’s page tables. In theory, this allows the operating system to address the “hidden” memory while keeping everything intact as 32 bit. In practice, most Windows device drivers fail when the system is put into 36-bit PAE mode. This aspect of PAE is therefore useful only for controlled environments like servers and supercomputing.4
1 Katz J. (1997), “Did Gates Really Say 640k is Enough For Anyone?,” Wired.
2 Microsoft Knowledge Base article #929605 and Microsoft Knowledge Base article #946003.
3 “Intel® 64 and IA-32 Architectures Software Developer’s Manual,” Volume 3A, section 3.8, Intel.
4 “Physical Address Extension – PAE Memory and Windows,” Microsoft Corporation, MSDN Library.