Click here to Skip to main content
16,004,806 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Building a new desk and looking for a new mouse pad... Pin
Nelek20-Sep-24 5:49
protectorNelek20-Sep-24 5:49 
GeneralRe: Building a new desk and looking for a new mouse pad... Pin
Jeremy Falcon20-Sep-24 6:44
professionalJeremy Falcon20-Sep-24 6:44 
GeneralRe: Building a new desk and looking for a new mouse pad... Pin
Nelek11hrs 24mins ago
protectorNelek11hrs 24mins ago 
GeneralRe: Building a new desk and looking for a new mouse pad... Pin
Choroid20-Sep-24 5:54
Choroid20-Sep-24 5:54 
GeneralA Discussion of Address Space & Memory Pin
raddevus20-Sep-24 3:45
mvaraddevus20-Sep-24 3:45 
GeneralRe: A Discussion of Address Space & Memory Pin
obermd20-Sep-24 3:53
obermd20-Sep-24 3:53 
GeneralRe: A Discussion of Address Space & Memory Pin
raddevus20-Sep-24 4:05
mvaraddevus20-Sep-24 4:05 
GeneralRe: A Discussion of Address Space & Memory Pin
trønderen3hrs 51mins ago
trønderen3hrs 51mins ago 
Once upon a time Windows and x86 hardware memory management were more closely related; the hardware could be much more fully exploited. But Microsoft hoped Windows to be The OS for all different sorts of processors, so it was ported to Alpha, MIPS, PowerPC, Itanium, and I believe there were beta releases for other CPUs as well that never made it to the market. MS didn't want to build their memory management on mechanisms available on x86 only, so instead of exploiting the x86 MMS to its fullest extent, they switched to a single, flat memory space which is managed by software in several areas where x86 hardware could have been employed.

x86 hardware allows a process to have a number of segments with different properties, mapped dynamically into the address space. A DLL would be a typical case of a code segment. The contents of a database could be data segment, like a memory mapped file. The sum of the data segment sizes used simultaneously by a process must fit into the 32 bit address space (without overlapping), but in principle, a process can replace one segment (code or data) with another one at runtime, if it really requires more that 4 GB of either code or data. All of it can reside in RAM; only segment descriptors are updated. Code and data are separate address spaces. Stack is a third address space. So in principle, a process could address 4+4+4 GB of memory (but the chips of the days didn't have enough address pins to allow addressing of 12 GB physical RAM).

The 386 came with a mechanism for making calls to the OS that switched to the segments of the OS. So the OS also had, in principle, a 4+4+4 GB address space, which was like in a different dimension from the user space. There was no way that the user could address OS space, whether intentionally or unintentionally. The problem is that switching between user an OS mode (with a 4-ring graded protection, in addition to privileged/unprivileged instructions) that it took far too much time. MS refused to use the mechanism.

Raymond Chen tells in one of his blog posts that in an MS/Intel meeting, the Intel guys asked what would be MS' highest priority for performance improvement, if only a single thing could be improved. The Intel guys though the MS answer was a joke: Faster handling of the illegal instruction interrupt. It was dead serious: Developers had identified it as the fastest way to enter privileged mode, so they used it as the basic mechanism for performing calls to the OS. They also put OS code/data and user code/data into a single address space, so that no update of segment or page tables is required. All three segments - a single segment for code, data, stack - was put on top of each other, offering new and exciting possibilities for data and stack to be interpreted as code, to make a jump into a data structure and other fascinating adventures Smile | :) , and also half of the address space left for the OS. 2 GB should be enough for everybody. (There was an option for doing a 1+3 split, and 3 GB should most definitely be enough!)

Certainly: Today, you can map files into you address space, and DLLs are more common than ever. It is not based on the segment hardware of x86, but using the same software mechanism on all CPU architectures regardless of hardware support available. Sometimes, such as with the system call mechanism, abandoning the hardware mechanism can actually be faster, yet I have somewhat mixed feelings: Shouldn't they put some more effort into improving the hardware, rather than abandoning e.g. protection of OS code by being isolated in a different address space, when the hardware was designed for it. Maybe MS was too quick in switching to a single, flat, shared address space. (Or maybe it has to do with employing chief designers with a background from architectures that had nothing comparable to offer.)
Religious freedom is the freedom to say that two plus two make five.

GeneralRe: A Discussion of Address Space & Memory Pin
MarkTJohnson20-Sep-24 3:59
professionalMarkTJohnson20-Sep-24 3:59 
GeneralRe: A Discussion of Address Space & Memory Pin
raddevus20-Sep-24 4:09
mvaraddevus20-Sep-24 4:09 
GeneralRe: A Discussion of Address Space & Memory Pin
Jeremy Falcon20-Sep-24 4:37
professionalJeremy Falcon20-Sep-24 4:37 
GeneralRe: A Discussion of Address Space & Memory Pin
raddevus20-Sep-24 4:47
mvaraddevus20-Sep-24 4:47 
GeneralRe: A Discussion of Address Space & Memory Pin
Jeremy Falcon20-Sep-24 5:04
professionalJeremy Falcon20-Sep-24 5:04 
GeneralRe: A Discussion of Address Space & Memory Pin
raddevus20-Sep-24 5:11
mvaraddevus20-Sep-24 5:11 
GeneralRe: A Discussion of Address Space & Memory Pin
Jeremy Falcon20-Sep-24 5:36
professionalJeremy Falcon20-Sep-24 5:36 
GeneralRe: A Discussion of Address Space & Memory Pin
honey the codewitch20-Sep-24 9:26
mvahoney the codewitch20-Sep-24 9:26 
GeneralRe: A Discussion of Address Space & Memory Pin
raddevus20-Sep-24 10:00
mvaraddevus20-Sep-24 10:00 
GeneralRe: A Discussion of Address Space & Memory Pin
honey the codewitch20-Sep-24 10:01
mvahoney the codewitch20-Sep-24 10:01 
GeneralRe: A Discussion of Address Space & Memory Pin
charlieg17hrs 17mins ago
charlieg17hrs 17mins ago 
GeneralRe: A Discussion of Address Space & Memory Pin
honey the codewitch17hrs 13mins ago
mvahoney the codewitch17hrs 13mins ago 
GeneralRe: A Discussion of Address Space & Memory Pin
Peter_in_278021hrs 59mins ago
professionalPeter_in_278021hrs 59mins ago 
GeneralWordle 1,189 Pin
Shane010319-Sep-24 18:10
Shane010319-Sep-24 18:10 
GeneralRe: Wordle 1,189 Pin
GKP199219-Sep-24 18:32
professionalGKP199219-Sep-24 18:32 
GeneralRe: Wordle 1,189 Pin
jmaida19-Sep-24 19:11
jmaida19-Sep-24 19:11 
GeneralRe: Wordle 1,189 Pin
OriginalGriff19-Sep-24 19:50
mveOriginalGriff19-Sep-24 19:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.