sliter
sliter

Reputation: 1093

What's the relation between 32/64-bit application, OS and processor?

I've googled these topics, but not sure if I understood their relations correctly. I summed up the following points, please correct/complement.


Also, I've got two questions relates to memory.

  1. The layout of the memory map of a processor seems independent of the processor's instruction size. For example, most Intel Core 2 systems(64-bit) have a memory map pretty close to picture shown below. Why the 64-bit processor does not choose a wider range of memory map?

    enter image description here

  2. What limits a 64-bit OS to use up to (2^64 - device/bus addresses) size of RAM?

Upvotes: 0

Views: 2390

Answers (1)

x539
x539

Reputation: 1014

There are many different kinds of processors out there (ARM, MIPS, x86, …).

I can just talk about x86(32bit)/x86-64(64bit).

The bit count refers mainly to the register size. For x86 the virtual address space is restricted to 32-bit (4GiB). That means a 32-bit application (an app that assumes it runs on a 32-bit CPU) can only see 4GiB at once.

For x86-64 all virtual addresses are 64-bit in size. But CPUs are free not to support all 64-bits, by requiring all unsupported bits to have be the same value as the most significant supported bit. The OS has to query the number of supported bits. (my Core i5 supports 48-bits here)

The physical address space, i.e. the amount of memory that can actually be handled by the CPU, is for x86 in the first place 32bit in size. But since about Pentium 1, CPUs support an Pyisical Address Extension (PAE) allowing up to 36-bit (64GiB) of RAM. (The OS has to enable the extension)

For now x86-64 restricts physical address space to 52-bit (4PiB). Where here again CPUs a free to support less bits. (my Core i5 supports 36-bit here)

Since both x86 and x86-64 use the same opcodes with slightly different meanings, a 32-bit application can not just run on a 64-bit CPU (in 64-bit mode/long mode).

But x86-64 has a so called compatibility mode, (a sub-mode of long mode), that allows it execute 32-bit apps. (The OS has to switch the mode.)

The memory map is not chosen by the processor. It is the responsibility of the mainbord & BIOS, and can partly be configured by the OS. The reason for the mainbord & BIOS manufactures to keep all the stuff in the lower 4GiB of address space, is compatibility with 32-bit OSes. (For compatibility reasons with old 16-bit-DOS-apps, even x86-64 CPUs by default disable accesses to every 2nd MiB of physical address space)

As a mentioned x86-64 restricts the physical address space to 52-bit by specification. Farther is the address space restricted by CPU implementation and even farther by mainbord implementation. (All that is done to reduce implementation costs). So there is no way to address 2⁶⁴ of RAM.

Upvotes: 3

Related Questions