32bit OS, 64 Bit Cpu architecture 4GB ram. How can it be possible?

Solution


Ah yes, the lovely memory limit question that people have consistently been getting wrong for almost 20 years.

Anyway, put on your learning hat and follow along.

On x86 microprocessors the memory architecture is divided into 3 different spaces, the segmented address space, the linear or virtual address space, and the physical address space. Segmented addressing is depreciated, so for all...

lovethee

Honorable
Oct 9, 2013
17
0
10,510
Okay thanks, forgot about unsigned integers.
One more thing, in the specs, it lists

CPU Main Features: 64 bit Dual Core Processor

Isn't it counter purpose to run a 32bit OS on a 64bit CPU?
 


Ah yes, the lovely memory limit question that people have consistently been getting wrong for almost 20 years.

Anyway, put on your learning hat and follow along.

On x86 microprocessors the memory architecture is divided into 3 different spaces, the segmented address space, the linear or virtual address space, and the physical address space. Segmented addressing is depreciated, so for all intents and purposes it is considered to be the same as the linear or virtual address space.

All applications execute in what's known as a "virtual memory space". This space appears to start at address 0 and runs all the way up to the limit of the architecture's native address size. For a 32 bit operating system this goes from 0 to 0xFFFFFFFF, for a 64 bit operating system this goes from 0 to 0xFFFFFFFFFFFFFFFF.

Every isolated process has its own virtual memory space, every single one starts at zero and ends at the appropriate point. Isolated processes do not see the memory of other processes within their own virtual memory space unless they specifically request access to it through shared memory. This means that two completely different processes can have different data at the same virtual address. How can this possibly be? The answer is that the same location in two different virtual address spaces can point to two different locations in physical memory.

The process of mapping virtual addresses to physical addresses is called virtual to physical address translation. The process involves performing what's known as a page walk which uses the bits from the virtual address as indicies in sequence of lookup tables stored in memory in order to resolve the physical location of that memory (if it's presently in physical memory) or to determine if it's been swapped out to the hard disk.

It should be obvious that if each process is allocated a full virtual address space that every virtual address for every process cannot possibly be mapped to a unique physical address. If a 32 bit system has 50 isolated processes each with its own virtual address space, that would require to 200GiB of physical memory. Thus, some virtual addresses must point to nothing at all.

While 32 bit operating systems are limited to 32 bits for the virtual address, the physical address can be larger. In fact, this has been the case every since the Pentium Pro was introduced in 1995. The physical address width was extended beyond 32 bits (between 36 and 54 bits in most cases) and a new processor extension known as PAE or Physical Address Extension was introduced. When PAE is enabled, 32 bit virtual addresses are mapped to 64 bit physical addresses (even if not all the bits are used). Now, a 32 bit virtual address space can be a subset of a 64 bit physical address space rather than a subset of a 32 bit physical address space. Each application is still limited to 4GiB of virtual memory without performing some dangerous page table manipulation, but the system as a whole could contain much more.

Microsoft Windows has supported PAE since Windows 2000, and has had it enabled by default ever since hardware Enforced Data Execution Prevention was introduced in the mid 2000s. In fact, the 32 bit version of Windows 8 requires PAE to be present and enabled as it does not have a non-PAE kernel like Windows XP, Vista, and perhaps Windows 7. Similarly, older versions of Windows that do not have PAE kernels cannot be installed on microprocessors with hardware enforced DEP without first disabling it in the system settings. The same is true for all versions of Ubuntu starting with 12.04, PAE is used for all 32 bit installations as it is required for security purposes.

With this in mind, Microsoft still caps the physical address space to 4GiB for marketing reasons, and as a result of some buggy third party drivers. It is certainly capable of much more, and the 32 bit version of the server operating systems support more than 4GiB dating all the way back to Windows 2000.

The other limitation is known as the 2GiB limit. This is related to the virtual address space, but not in the same way as above.

Microsoft windows divides each application's virtual memory space into two. One half is for the application's own code and data, and the other half is for shared system resources. Whenever an application wants to perform any task that affects the system as a whole such as accessing the file system or processing inputs and outputs it must do so through the operating system itself. The application makes a system call which triggers a privilege escalation and a jump in execution to the operating system's own code where the request is handled, and then a jump back to the application's code accompanied by a de-escalation in privilege.

The operating system's own code and data is stored in one half of the virtual memory space, and the application's code in another. This restrict's the application's working room to 2GiB of the 4GiB virtual address space.

There is an optional configuration which constricts the operating system's space to one quarter of the virtual address space, which provides the application with up to 3GiB of physical memory to work with.

Although the functionality is similar, 64 bit operating systems do not have this same limitation.
 
Solution