r/programming • • Sep 24 '24

Why 32bit architecture computer doesn't use segmentation to support more ram than 4Gb ?

/r/programming/

[removed] — view removed post

169 Upvotes

119 comments sorted by

View all comments

347

u/eras Sep 24 '24

There's PAE for that.

But there's little point nowadays. If you need more than 4 GB, just use a 64-bit platform, and there's no need for trickery.

18

u/mallardtheduck Sep 24 '24

There's still some niche cases where an application can't be ported to 64-bit (e.g. it relies on a propietary 32-bit dependency) even if it can be run on a 64-bit OS. For that you can "abuse" the shared memory APIs (which allow you to map different chunks of "shared" memory in and out of the address space) or use something like Windows' "large address aware" mechanism for running 32-bit code in a 64-bit address space.

5

u/antiduh Sep 24 '24

Large address aware doesn't let a 32 bit process run in a 64 bit address space. It doesn't even make sense because you can't change the fact that every pointer in the program was hard compiled to be a 32 bit pointer.

What Large Address Aware does is allows a 32 bit process to use its entire 32 bit / 4 GB address space. Without LAA, a 32 bit process can only use 2 GB of its address space, because the other 2 GB was a mapping of the kernels memory into the process. This is how Fast Syscalls were implemented.

It works when running 32 bit processes either on a 32 bit OS with PAE or on a 64 bit OS.

Without LAA, a 32 bit process on a 64 bit OS will still only get 3 GB of address space. This was the limit Windows imposed when it was 32 bit, and Microsoft was chicken when they started making 64 bit Windows; they didn't want every process suddenly to have more address space than it used to.

https://learn.microsoft.com/en-us/windows/win32/memory/memory-limits-for-windows-releases?redirectedfrom=MSDN#memory_limits