3

I'm struggling to really understand memory segmentation.

It's the topic of memory segmentation related to segments like heap,stack,code in an object file?

Maybe they're for sure, but I still can't find a link and would love if someone can shed light on how the're related if they are.

I've read in my book that segmentation it's not used anymore in x86-64, is it true for the object file segments too?

Thank you for helping out, and excuse me if it does seem obvious to you, but I'm writing this question after a long day of studyng and I need some clarification.

2

The segmented memory model of the 8086 (x86 real mode) is indeed something that belongs to the past. With 32 and 64 bits cpus, there's no longer a need for segment registers to extend 16 bit registers in order to address a 20 bits memory address space: the set of registers is organized to manipulate 32 and 64 bits addresses without pain. The current mainstream operating system all use virtual address spaces.

The segmented memory access shall however not be confused with segments in an object file. These object segments are grouping of related data or code which should be kept in a consecutive bloc of memory of the address space (whether it's physical or virtual). Different segments can be loaded in different memory address range. This is managed by the linker of your toolchain (manage the segments) and the loader of your OS, that will read the executable and the library into memory space (but after the virtual memory space is initialized for the process by the OS).

So same name but two completely different things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.