[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 64 vs 32 lenny

Micha Feigin wrote:
On Fri, 20 Mar 2009 18:54:58 -0500
Mark Allums <mark@allums.com> wrote:

Oops, make that *3* GB or less. The PC architecture allows more, but while 4 GB fits into 32-bits, the video card and other hardware is memory-mapped into the upper GB, so the 4th GB of physical memory must be remapped above the 4 GB line. In theory, with PAE segments you can address that memory with a 32-bit OS, but in practice, 64-bit is required.

It's not so much the video card any more (used to be that the video card was
mapped into this space but it was a long time ago in the days of far pointers
and memory size less than single digit megabytes).

It's the kernel memory that is mapped there. By default the application has a
four giga memory space under 32bit, two of which are actually used by the
application and two for kernel mode. This is used to reduce overhead during
context switching between usermode and kernel mode.

You actually need a patch to change this to a 1:3 ratio instead of a 2:2 ratio.

Video is still mapped into that space, just not all of the card's memory.

I was aware of the 2:2/1:3 choice, I mistakenly had my XP system set for 1:3 at a time that I was ignorant of the implications under Windows. (Short summary: Don't try this at home.)

However, the 4 GB space you are referring to is in Virtual Memory. The 4 GB space I was referring to was in Physical memory.

I am sure I am not saying anything you don't already know, but: There is a difference, in that virtual memory space has a very large size (I forget the number at the moment, the exact figure is unimportant) but physical addressing is limited to 40 bits. (Still a large number.) PC architecture at the time of NT/XPs design was limited to 4 GB. (I am talking about garden-variety PCs, not workstations or servers.) The application sees virtual, but the OS must manage. NT/XPs architect (I forget his name right now, he also designed VMS for DEC) and the other engineers made a design choice that XP and other 32-bit non-server Windows OS would never use more that 4 GB, and chose the 2:2 split, as you say, to make things more efficient, at a time when 2 GB of memory was enormous.

However, at that time, that hardware didn't even exist. So, we are now somewhat stuck with the design of the physical hardware. When AMD came out with the Athlon 64, it was grafted on to a 32-bit architecture. Microsoft decided (in it's infinite wisdom) not to extend 32-bit, consumer-grade XP beyond the 4 GB physical limit.

CPUs from AMD and Intel beyond a certain stepping can address physical memory beyond the 4 GB limit, and the hardware memory-mapping in that physical space does not affect the virtual space, so for newer machines, the full 4 GB can be used. But it requires hardware support on the motherboard and the CPU, and a BIOS that is not buggy.

I know relatively little about the history of the Linux kernel's use of memory. And I am not an OS guru, so I don't know the exact method of memory management that is used in most PCs.

All I am saying is that 32-bits is full of legacies and gotchas, and it is time we moved on. If I get details wrong, well, I am one of those guys who talks when they should listen (a "big picture" guy ;) ), so feel free to contradict and correct me wherever I need to be corrected.

Cheers, :)

Mark Allums

Reply to: