Sunday, 4 March 2012

32 vs 64 bits again

This post is a bit of complementary of this one I wrote some months ago. This week, someone at work said it was possible to install Windows 7 64 bits on a 32 bits processor. Well, I was pretty certain that was absolutely impossible (same as you can't run a 64 bits application on a 32 bits OS). Obviously the 64 bits OS will make use of the 64 bits registers (otherwise it would not be a 64 bits OS), and those registers are not available in your 32 bits processor (what I've heard is that it's possible to install it on a VM, but I think the performace is terrible, imagine what the VM will have to do to emulate the 64 bits registers...). Anyway, I don't like entering into a discussion before doing some previous extra research.

After checking a few articles I confirmed that I was correct and my colleage confused. A 64 bits OS can't run on a 32 bits processor, same as a 64 bits application can't run on a 32 bits OS. This is one of the best articles that I found, with some rather interesting tables:

Another interesting point they mention there and that should also seem obvious, but I'd never thought of it before, that you can't run 32 bit drivers on a 64 bits OS. The driver's kernel mode code can not run inside the WOW64 emulation system

One more thing that came to my mind is, given than as I explained in my post from October, 64 bits windows applications can't load 32 bits components (dll's, COM components...) what happens for example with Internet Explorer 64 bits and all those intranet applications that use some client side COM component? (we have several of them at work, some of them close to critical)
The answer is here. Your 64 bits Windows system includes 2 Internet Explorer versions, one 64 bits (the default one), and one 32 bits. So for those cases all you need is just launching the 32 bits version.

I think another interesting topic is how much memory is now available to the OS and to an application.

  • In 32 bits systems (processor and OS), we had a maximum of 4 Physical GBs of memory accessible to the OS. That's the maximum address you can reference to from those 32 bits registers. However, you end up having quite less than 4 GBs of physical space to you, normally around 3 GBs. Why? because of Memory Mapped IO. The memory and registers of the I/O devices are mapped to (associated with) the upper physical addresses in the main memory. Bear in mind that then the (let's say) 512 MBs of your Graphic Card are reducing the amount of Physical Memory available to the OS, not because the Card is storing data there, but because those addresses are reserved to communicate with the GC physical memory... That's why usually a Windows 32 bits OS can't see more than 3 GBs of physical RAM...

    With a 64 bits system, as much more memory is addressable the memory addresses reserved for IO mapping will be further up from the top of the Physical memory available in your system.

    In the Virtual Memory arena, in a 32 bits system a 32 bits process has 4 GBs of Virtual Memory available to him, from which the 2 first GBs are reserved for the kernel, so indeed it's only 2 GBs of Virtual Memory what is available to the processor. Well, I can think of many applications for which only 2 GBs of memory seems pretty scarce...

  • In 64 bits systems, the theoretical limit of Physical Memory that can be addressed is 2 to the power of 64 bytes (that's 16 TBs I think), but in practice most OSs (well, at least Windows) impose restrictions (in Windows this goes from 8 GBs to 2 TBs, you can check the specific figures here)

    For the Virtual Memory, the limitations imposed to the Physical Memory are not applied, and then we have that for each 64 bits process there are 8 TBs of User Virtual Memory available to it (the other 8 TBs are for the Kernel).

This is a good read regarding all this.

I guess this write up has helped me understand how important 64 bits Systems are now not just for big servers, but for a normal user (I'm limited to 3GBs of Physical memory in both my laptops, and well, with Visual Studio, Eclipse, FireFox and Lotus Notes running, that´s far from optimus.

No comments:

Post a Comment