64-bit: facts and myths

Okay, I am so very tired of reading pseudo-technical idiots who think they need 64-bit versions of all their software, and give developers grief over it.  Here, I will beat the topic to death, hopefully inspiring these idiots to shut the hell up and let the programmers make the programming decisions.


If your PC has less than 4 gigabytes of RAM, you don’t need 64-bit anything! In fact, running a 64-bit OS on such a machine will only result in wasted memory or wasted performance (or both).  The reason for this is alignment.  Alignment means that if you have a 64-bit system, the CPU and operating system are designed to work with 64-bit pieces of information, or 8 bytes.  As a programmer, you want to make sure every piece of information starts on a multiple of 64 bits, to make it convenient for the processor to do its thing.  If your data isn’t properly aligned and straddles a 64-bit boundary, the computer has to read both halves separately, discard the bits it doesn’t want and put the rest back together in a 64-bit register.  This takes twice as long to do, so your fancy 3.2 ghz processor is wasting half of its time.

Programmers, of course, want everything to run fast, so we align almost everything and the problem goes away.  The downside is that, say I want to store a 16-bit number, I am putting it in a 64-bit bucket.  I am wasting 3 times more memory than I need, but the tradeoff is that my program runs a lot faster.  Do this for several million pieces of data and the wasted space really adds up.

Now the kicker: today’s processors can switch between 32-bit and 64-bit modes of operation, and they can be equally efficient at either one, but not both simultaneously, and while they can switch back and forth, this transition is quite slow (relatively speaking).  This means that a 32-bit OS can run just as fast as a 64-bit OS on the same processor, sometimes even faster.  Why ?  Because it takes less effort to read 32 bits of memory than 64, even after alignment is factored in.  DUH!  Less work = faster.

One notable downside of running a 64-bit OS right now, is the need for backward compatibility with 32-bit software. For example, a clean install of 64-bit Windows 7 uses about 300mb more Ram than the 32-bit version, just to sit at the desktop doing nothing, and it also requires a bit more disk space to install. This is due to having duplicate versions of shared components (DLLs, mostly), one for 32-bit apps, and one for 64-bit apps. They perform the same task, but for a number of reasons it is extremely impractical to have both architectures share the same DLLs.

Memory Limits

One of the big motivators for a 64-bit computer is to have more than 4 gigabytes of Ram.  In practice the 32-bit limit is around 3.2 gb, because your graphics card and motherboard also need to fit their junk under the 4 gb boundary.  A 64-bit system can access several TERAbytes of memory.  But wait…  a 32-bit OS can cheat and work around the 4 gb limit.  Magic ?  No, PAE – Physical Address Extensions.  It’s a feature in the chip, that’s been around since 1995.  How does it work ?  Well, think of a filing cabinet.  There are thousands of documents in it, but you only have one set of eyeballs and half a brain.  You take one document out, open it on your desk and start reading it.  Then you put it away and take another document out.  PAE is the same thing: the OS can only fit 4 gb of memory in its view at any given time, but it can put some pages away and bring other pages in.  It takes a little time to swap things in and out, but having fucktons of Ram tends to make up for it.

So why doesn’t a 32-bit Windows support more than 4 gb ?  Because Microsoft said so.  No, really.  Almost all computers running Windows XP or later are already using this PAE feature, as it confers some security benefits against certain types of viruses and overflow attacks.  The reason you can’t use your extra Ram is because Microsoft restricts this in their consumer operating systems.  They cite performance and driver compatibility issues, and it’s true: I did find one obscure device that crashed my PAE-enabled Windows.  Fire up Windows 2003 Enterprise and even the 32-bit can access 32gb of Ram.

Now that’s just the operating system.  32-bit applications are also limited to 4 gb memory each.  Actually with Windows you can only use 2 gb per application, the other half is reserved for internal use by the NT kernel.  So the real question is: does your application need more than 2 gb of data loaded at any one time ?  If the answer is no, you don’t need 64-bit anything.  Note: at one time!  If you’re playing a Blu-Ray rip, the movie file may well be 25 gigs, but you’re only displaying one frame at a time, which might require 20-30 mb to decode at the most.  No, I mean 2 gb of actively used data.  Generally speaking, the only things that will bust that limit are heavy databases, virtual machines, and scientific number crunching.  Almost any other task can be broken down into smaller pieces, like that Blu-Ray rip.  Even the most dazzling games don’t need that much Ram, they just need to store the current map and gamestate, along with a few sound effects, while the rest is offloaded to the graphics card which has its own memory.

So what’s the big fuss then ?

Well, for most users there isn’t any tangible benefit from switching to a 64-bit OS.  Performance-wise, you won’t notice anything.  Your games will still run, Excel functions will still baffle your feeble mind, and Firefox will still load slower than it should.  On the other hand, there is no reason not to switch, because everything will work just the same.

A guy like me almost has no choice but to go 64-bit.  I have 48 gb of Ram in this PC, and I work with databases, virtual machines and large number crunching all the time.  But I’m not the average Joe.  I don’t type “Facebook” into Google to get there.  I have several monitors, and a whole bunch of apps running simultaneously.  Sometimes I emulate a dozen servers to test clustering and load balancing.  I do crazy nerd stunts with this thing, most people don’t.

You said 32-bit is good enough, so why switch ?

Yes, I did say that.  I think 32-bit Windows needs to die.  Why ?  Because 64-bit Windows can still run 32-bit apps just fine, and just about any computer powerful enough to run Windows 7 already supports 64-bit operation, so why bother with the 32-bit variant ?  Sure, it wastes a little less memory, but it’s a whole separate system that requires support and testing.  I say fuck it!  Move everyone over to 64-bit so we’re all on the same platform, saving millions of programmers and I.T. guys a ton of grief and duplicated effort.  The benefits far outweigh the costs.

In the end, if you switch to 64-bit Windows, you won’t need a 64-bit Winamp and a 64-bit Freecell.  Some memory will be wasted, but you’ll be doing the tech industry a favour, eventually leading to lower costs for hardware and software due to having one less operating system to support, which is a big fucking deal.  And when Windows 8 comes out, or Crysis 2, or Freecell 2012, you’ll be able to upgrade to 12gb of Ram without having to reinstall everything (or pay a techie to do it for you).  So the next time you buy a new PC, or format your current one to clean out the junk, go 64-bit.  Do it for me, do it for your country, do it for science!

Both comments and pings are currently closed.

Comments are closed.