[Ham-Computers] linux and ram
Martin Gary
martin.gary at verizon.net
Wed Feb 11 23:12:57 EST 2009
Aaron,
That's the best explanation of 32 verses 64 bit apps I've seen. Thanks, that
helped me out a lot.
Marty - N3HRT
-----Original Message-----
Hi Jonathan,
The 4GB memory limit is a physical limitation of 32-bit architecture. In
binary, each bit is a power of 2, so 2^32=4GB. So the 4GB limit applies to
any 32-bit OS, not just Windows. For reference, previous well known x86
memory addressing limits were 1MB (original IBM PC architecture @ 20-bits)
and 16MB (IBM PC AT architecture @ 24-bits) - early versions of DOS could
only access 1MB total (640K RAM space) and later versions only 16MB RAM.
Program compatibility in 64-bit OS highly depends on how well the 64-bit OS
can isolate the 32-bit app. The problem is that the 32-bit app will not
"see" the upper 32-bits of the memory address. Here are some simple memory
addresses as examples (in binary, 8-bit groupings):
32-bit: 00000000 00000000 00000000
00000001
64-bit: 00000000 00000000 00000000 00000001 00000000 00000000 00000000
00000001
Hopefully, the e-mail system won't mangle those long lines. Basically,
these are the binary representations of the values "1" (32-bit), and 8GB+1
(or 8,589,934,593) (64-bit).
As you can see, in a full 64-bit environment, the 32-bit address only
contains the "lower" 32-bits. Programs witten in 64-bit code also include
the "upper" 32-bits. If you run a 32-bit app and pass it a 64-bit address,
it won't "see" the "upper" 32-bits - all it will see are the lower 32-bits.
So using these two examples, instead of using the address 8GB+1, a 32-bit
app will use the address "1" (because the upper 32-bits are not taken into
consideration). Can you see how this might cause a problem?
To mitigate this, good operating systems will attempt to run the application
in some sort of 32-bit compatibility mode -the application is given a 32-bit
environment to work in and is isolated from the 64-bit environment - Windows
did this with 16-bit apps. However, depending on how the application
interacts with the OS, there are certain times when the app may want to
access something in memory directly rather than via an OS call. In this
type of situation, the 32-bit app, not aware of the "upper" 32-bits of the
64-bit address space, might inadvertantly access an incorrect location and
possibly cause corruption of the incorrect address. The OS should catch
this and terminate the error with a fault, but this doesn't always happen.
I can't speak directly for Linux, but the same rules basically apply to any
OS. How well an older app runs in a 64-bit environment depends on how well
mannered it is with memory addressing (all memory address calls within it's
own address space or via OS calls) and how well the OS "manages" the older
app. Some OS' (and/or apps) are better at this as they were written (or
updated) with 64-bit computing in mind.
Hope this helps answer your questions!
73,
- Aaron, NN6O
.
More information about the Ham-Computers
mailing list