Why can Mac OS X 32-bit access all 4GB of memory, while Windows 32-bit can't?

Solution 1:

Recommended reading: Road to Mac OS X Snow Leopard: 64-bits, Santa Rosa, and more (and the rest of Prince McLean's Road to Snow Leopard series). If you don't want that much reading, I'll summarize:

First, you have to realize that OS X doesn't have a single 32/64-bit mode switch like Windows does; It'll happily run 64-bit apps under a 32-bit kernel, or vice versa, and both of those are independent of what the physical memory subsystem can support. Mind you, the bitness of apps and kernel do impose memory limits: an app running in 32-bit mode can only address 4GB of virtual memory no matter how much is installed/supported in the machine (although a Mac with lots of RAM can run several fully-resident 4GB processes at once); and if the kernel is in 32-bit mode it can only allocate up to 4GB for its various data structures (page table, process table, open file table, etc). This is already a bit different from the way Windows does it, as it shares address space between the kernel and the running process, so they each only get 2GB. The advantage of the Windows method is that it doesn't require a cache flush to switch in and out of the kernel, making it faster. But OS X only needs to flush the cache if both the program and kernel are in 32-bit mode; if either is 64-bit, they share space and avoid the speed penalty.

Now, on to the question you're asking about: physical RAM limits. Many early Intel Macs actually have the same ~3GB memory limit that 32-bit Windows has, for the same reason: some of the 4GB physical address space is taken up by memory mapped I/O, especially the video card. Some later Macs used the Santa Rosa support chipset, which allowed them to put the I/O in a separate address space, and use up to 4GB of physical RAM. Higher-end (/even newer) Macs have PAE, which allows much more physical RAM. Rumor is that Windows doesn't support PAE in most of their 32-bit OSes because of driver compatibility problems. Apple controls most of the relevant drivers anyway, so they made it work; if the hardware supports it, the OS just uses it.

Solution 2:

via http://en.wikipedia.org/wiki/Physical_Address_Extension

To use PAE, operating system support is required. Intel versions of Mac OS X support PAE. The Linux kernel supports PAE as a build option and most major distributions provide a PAE kernel either as the default or as an option. FreeBSD and NetBSD also support PAE as a kernel build option.

Microsoft Windows implements PAE if booted with the appropriate option, but current 32-bit desktop editions enforce the physical address space within 4GB even in PAE mode. According to Geoff Chappell, Microsoft limits 32-bit versions of Windows to 4GB due to a licensing restriction, and Microsoft Technical Fellow Mark Russinovich says that some drivers were found to be unstable when encountering physical addresses above 4GB.

Solution 3:

From here: http://www.tomshardware.com/forum/231766-45-windowsxp-recognizing

"Windows XP Professional 32-bit is limited to 4GB of address space. If you have 4GB of RAM installed, it will not show 4GB within Windows. What you'll probably get is the size of your pagefile subtracted from the 4GB.

Some of this address space is reserved for hardware and the OS... so you'll never have access to the full 4GB anyway. If you want to access 4GB+ of RAM... your best solution is to pick up XP Pro 64-bit... but that will only work if your P4 CPU has EMT64."

A more detailed answer can be found at: http://www.codinghorror.com/blog/2007/03/dude-wheres-my-4-gigabytes-of-ram.html