4 ms·
> But memory isn't a linear address space Would you mind expanding on this point a bit?
by twtw 8y ago
> But memory isn't a linear address space
Would you mind expanding on this point a bit?
- wruza 8y agoI think it was mostly aliasing-related, and that’s why I mentioned “tell which bytes point at which”. Managing C today is like managing that girlfriend who doesn’t say anything straight and avoids direct conversations. I’m not against optimizations, I’m against compiler pretending to be smarter than average me and spoiling our relationship when I only have basic demands. If not that, I’m also curious.
- Too 8y agoSorry but it's the other way around. You are the one pretending to be smarter than the compiler by imagining objects are laid out sequentially in an infinite char[] when they they are in fact just abstract objects laid out in whichever way the compiler thinks is best. Just keep it this way and it will be much easier to manage C, it doesn't need micro management and neither does girlfriends.
- wruza 8y agoI'm saying that I don't like this model, not that I want to see everything as char[] in it. You insist that I should just embrace the model, since char[] doesn't work in it. I know, ok? If that tauthology was an argument, it completely missed the point. Below the compiler, I'm pretty familiar how things are laid out, since there is ABI, packing/alignment rules, documented hardware and 15 years of dealing with them. Please don't mock up magic and wisdom out of few conventions.
- ChrisSD 8y agoModern memory is layered. You have registers, you have three layers of CPU cache, etc, etc. At higher levels of abstraction we pretend like it's all flat but we do need to allow for optimizations to occur.
- wruza 8y agoSo what that does with linear addressing and optimization? How the presence of registers and caches depend on [non-]linearity?
- twtw 8y agoThanks for responding. I would however argue that the existence of hierarchy in physical memory is orthogonal to the existence of a linear address space. Caches work really hard to maintain the ability of programs to use a single linear address space.
- fulafel 8y agoWays in which memory is not linear: many asymmeyric multiprocessing setups (eg gpu/cpu), distributed processing (eg openmp), multiprocess systems w several virtual spaces, harvard architecture systems, segmented architectures, disk vs ram. Many of these may be considered performance motivated departures from linear address space, especially if performance includes reliability in addition to execution speed. (Otoh virtual memory can be used to create the appearance of single address space for any of the above, and sometimes has been - eg as/400)