PAE – Physical Address Extension « Różności …

Różności …

23 lutego 2011

PAE – Physical Address Extension

Zaszufladkowany do: Informatyka - pozostałe — Jacek @ 08:11

PAE (Physical Address Extension) is a “workaround” for letting x86-32bit(!) OS see more than 4GB of RAM. 4GB is the limit for 32bit memory addresses. PAE is not needed and not implemented on x86-64 processors when 64 bit (“long mode“) is enabled.

How does it work?

In short, it simply adds 4 bits to the memory addresses (32bit -> 36bit) and one more level of memory-lookup-hierarchy, and: voila, OS can access up to 64GB ram (which is not “science fiction” these crazy days..). Of course, a single 32bit process is not aware, and would still only have a 4GB of virtual address space, even with PAE.

Performance penalty: yes or no, and how much?

PAE is hardware supported since Intel Pentium Pro (back in the mid 90s..). Reading “hardware supported” might mislead, and make one think that it’s all accelerated and there’s no performance penalty. But still, even in hardware, PAE adds one more hierarchy level for memory lookups, and my weak hardware knowledge tells that it might still slow something down…

The Linux kernel of most 32bit distributions (in particular RedHat 5) ships with PAEdisabled, while an optional PAE-enabled kernel is available. On 32bit Windows, PAE used to be disabled by default, but since WinXP SP2 windows is PAE-enabled by default. I’ve also seen some Linux distros enabling PAE in their default kernel recently.

Googling for “PAE performance affection” was not easy, and that’s the main reason I wrote this article: to spread the knowledge. Best articles I’ve found are specified at the bottom.

Research conclusions:

  1. Main reason for PAE being disabled by default, seems to be hardware compatibility: hardware with no PAE support can’t boot a PAE-enabled kernel. That’s mostly history now, anyway, for all recent x86 processors support PAE.
  2. Performance penalty is very low (according to RedHat average is 1% and no more than 10%). Of course it depends on your exact scenarios, etc etc.
  3. As a friend suggested me: in most cases PAE is not needed, for x86-64 is so widely spread. One can simply run his 32bit apps on a 64bit OS. PAE lets the OS see up to 64GB, while x86-64 (current implementations) lets the OS see at least 16TB! So my main conclusion is.. that PAE is dead. All modern x86 processors (since ~year 2006) have x86-64 support.
  4. Best thing is compiling your code as 64bit and running a 64bit OS, of course

Accessing beyond the 4GB on 32bit mode

According to the PAE article on Wikipedia, there are ways for accessing areas of RAM beyond the regular 4GB of virtual address space. Looks like Windows has a nice API for that: Address Windowing Extention, and Linux is able to do it with mmap() system call. I couldn’t figure out how, though.

Włączenie i wyłączenie:

Windows automatically enables PAE if DEP is enabled on a computer that supports hardware-enabled DEP, or if the computer is configured for hot-add memory devices in memory ranges beyond 4 GB. If the computer does not support hardware-enabled DEP or is not configured for hot-add memory devices in memory ranges beyond 4 GB, PAE must be explicitly enabled.
To explicitly enable PAE, use the following BCDEdit /set command to set the pae boot entry option:
bcdedit /set [{ID}] pae ForceEnable
IF DEP is enabled, PAE cannot be disabled. Use the following BCDEdit /set commands to disable both DEP and PAE:
bcdedit /set [{ID}] nx AlwaysOff
bcdedit /set [{ID}] pae ForceDisable
Windows Server 2003 and Windows XP/2000:  To enable PAE, use the /PAE switch in the Boot.ini file. To disable PAE, use the /NOPAE switch. To disable DEP, use the /EXECUTE switch.

Check type of OS (64 or 32 bit)

  1. Click Start, then click on Run or Start Search.
  2. Type msinfo32.exe and then press Enter key.
  3. In “System Information”, review the value for the System Type item:
    • For 32-bit editions of Windows, the value of the System Type item isx86-based PC.
    • For 64-bit editions of Windows, the value of the System Type item isx64-based PC.

Źródła:

http://www.held.org.il/blog/2008/07/pae-whats-that-and-how-bad-for-performance/

http://msdn.microsoft.com/en-us/library/aa366796(v=vs.85).aspx

http://www.mydigitallife.info/2008/03/19/how-to-check-if-windows-vista-xp-and-2003-system-is-32-bit-or-64-bit-x86-or-x64-version/

Brak komentarzy

Brak komentarzy.

Kanał RSS z komentarzami do tego wpisu.

Przepraszamy, możliwość dodawania komentarzy jest obecnie wyłączona.

Strona startowa: www.jaceksen.pl