Features of the memory subsystem in MacOS X 10.6 Snow Leopard

Original author: Appleinsider
  • Transfer
The following is a translation of the article “Road to Snow Leopard: twice the RAM, half the price, 64-bits” from AppleInsider.com. The article touches upon the features of the memory subsystem of the announced OS, and also contains a comparison of the operation of the memory subsystem in 32-bit OS from Apple and Microsoft.

System memory versus application memory.


While the 4GB limitation described earlier is only beginning to affect everyday users, there is another problem that limits the full use of installed memory to a specific application. In fact, the real problem of lack of RAM is not how much memory you can install, but how much memory the application can address for its needs.
32-bit versions of Windows, Linux, and Mac OS X manage 4 GB of memory differently. This means that their transition to 64-bit versions will give users completely different improvements. In 32-bit versions of Linux and Mac OS X, the kernel allocates 4 GB of virtual memory for itself and the same amount for each application (or process). The virtual memory subsystem allocates memory based on maximum performance considerations. It is clear that the more memory, the better.
In the 32-bit version of Windows, each application receives only 2 GB of virtual address space; 4 GB are shared by the kernel. By default, the split occurs in half, so that the application gets 2 GB for use, while the kernel reserves the remaining 2 GB. Using a special setting, Windows can be installed in the proportion of 3 GB / 1 GB, which gives the application another GB, but does not allocate all 4 GB. This affects every application that needs a lot of memory.
The reason for this separation in Windows is performance. Windows system calls can address the memory allocated for the application and for the kernel in one approach, because the CPU can directly address both the kernel memory and the application memory using the TLB cached lookup table.

The more memory, the more responsibility


In contrast to Windows, 32-bit versions of Linux and Mac OS X provide each application with all 4 GB of virtual memory, their addresses overlap with the addresses of the kernel. This means that the TLB table of the central processor cannot store cached addresses, because it cannot distinguish one from the other.
Each time a memory subsystem moves between two address spaces, it must clear the TLB table. Each call to a 32-bit system clears TLB twice, re-setting the cache to zero and thereby reducing performance, for which it was invented. On Windows, cleanup occurs only when switching between applications, as each application shares its virtual memory space with the kernel.
On 64-bit Mac OS X Leopard, 64-bit applications have an enormous amount of memory that far exceeds 4 GB. This allows 64-bit applications to occupy higher address spaces, while the kernel occupies lower ones. In the absence of address overlay, TLB does not need to be reset and it can work exactly as intended. This advantage has not yet been fully used, since the kernel and most applications are still 32-bit (to the left in the figure below).
Snow Leopard will make it possible to use the 64-bit kernel and applications, completely eliminating the need to clear TLBs, because the new kernel will not have shared address spaces, even in the case of 32-bit applications (on the figure below, on the right). This will be an advantage for all users using a 64-bit OS and a Core 2 processor or better, even when using the Santa Rosa chipset, which will also be able to run 64-bit applications and the virtual memory will not be limited by the amount of addressable system memory.

Bigger Better Faster


Current 32-bit applications (Macs) have access to more memory than 32-bit Windows applications, but at the same time they reset the TLB table every time the application makes a system call than if it simply switched between applications. With the advent of 64-bit, Leopard offers great performance with unlimited virtual addressing.
In 64-bit Windows, applications will go beyond 2 GB of addressable space, but there will be no significant performance gain, since Windows has not previously encountered the problem of clearing TLBs.
Both platforms will benefit from additional 64-bit registers. This factor also explains why PowerPC G5 users won't see a big performance boost from standard applications ported to 64-bit. 32-bit PowerPC applications already have extra register space. In most cases, they will work even slower due to the additional work of addressing. This is one of the key reasons why Snow Leopard will only be Intel.

The dark side is 64-bit.


There is an additional load on Intel in connection with 64-bit addressing; it is due to the lack of a market for 64-bit applications for the Windows platform. Adobe encountered this issue when releasing Photoshop CS4.
At the same time, all Macs are now 64-bit and use a 64-bit OS, so there is no problem adapting Apple's previously written 64-bit programs. Except perhaps programs from third-party developers. Apple should provide developers with new versions of drivers and plugins for the new kernel and force third-party developers to do the same.

Also popular now: