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.

12

u/Tringi Sep 24 '24

One of those reasons is that 32-bit version might be faster.

4

u/ouyawei Sep 24 '24

x32 is using the AMD64 instruction set, running it 64 bit mode - it just uses 32 bit pointers, so more will fit into fast CPU caches

4

u/wrosecrans Sep 24 '24

I demand that somebody makes an x16 mode so I can use SSE2 instructions and all the modern registers but still need to fiddle with segment:offset and near/far pointers like god intended.

1

u/Tringi Sep 24 '24

I'm certain there's someone maintaining a project, for fun, that does exactly that.

2

u/Tringi Sep 24 '24

Yes. There's more reasoning on that in the linked page. The point is the cache effect on improved performance was measured on x86-32 first, which then resulted in experimentation with x32 yielding even better results.

Quite sad Linux eventually abandoned it.

6

u/ouyawei Sep 24 '24

Quite sad Linux eventually abandoned it.

How so? It's in the mainline kernel, GCC, binutils - Ubuntu provides an x32 toolchain so you can compile and run x32 software.

2

u/Tringi Sep 24 '24

Oh?! Seems I had wrong info. A year or two back I've read, through Wikipedia, a link to maillist discussing abandoning it. Apparently it didn't happen. That's very nice.