内存地址在哪里?名称/标签已存储?

发布于 2024-12-09 06:09:58 字数 260 浏览 0 评论 0原文

如果我用一个类比来解释一下会更好。就这样...

1.公园大道 52 号有一栋房子 --(内存地址)

2.我住在里面 --(数据)

3.如果你问我住在哪里,我会说“52” ,公园大道”(我指的是记忆位置)

但是,即使我搬出或居住在其中,房屋的前草坪上也有其“门牌号和街道名称”作为“标志/板”......无论哪种方式! 现在这个“标志/板”存储在哪里?

简而言之 - 例如,我们如何知道特定的内存地址是“x0y34vf”?

It'd be better if i explain this with an analogy. Here it goes...

1.There's a house at 52, Park Avenue -- (The memory address)

2.I reside in it -- (Data)

3.If you ask me where i live, I'd say '52, Park Avenue' (Im referring to the memory location)

But a house has its 'Number and Street name' in its front lawn as a 'Sign/Board' even if i move out or reside in it... either way!
Now where is this 'Sign/Board' stored for a memory location?

Simply put - How do we know that a particular memory address is 'x0y34vf' for example?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

意犹 2024-12-16 06:09:58

内存被映射到一个表中,该表包含两组:虚拟地址(如十六进制地址)以及实际扇区和页(如果需要该地址)。

现在您可能会问的一个问题是,为什么每次我访问相同的十六进制地址时,我都会得到不同的值,尽管它们都是垃圾。

答案是,当你编译并运行你的程序时,程序会被加载到RAM(随机存取存储器)中,并在运行完成后被换出。因此,第一次你的程序可能会在块 90 处获得一个空间,因为内存是空闲的。但在第二次运行时,程序可能会加载到另一个块(例如 720)。这仅回答了一半。

同样,页面映射表会针对可用空间和空间利用率进行更新,因此尽管源代码中的地址保持不变,但在执行时您会获得该地址的不同值。

Memory is mapped into a table which contains two sets, virtual address like the hex one and the actual sector and page that it should go if that address is asked for.

Now a question you might ask is, why is it that every time i access the same hex address, i get different values though they are garbage.

The answer is that when you compile and run your program, the program is loaded to RAM(Random Access Memory) and swapped out when you finish it running. So the first time your program might get a space at say literally at block 90 as the ram was free. But on second run time, the program might be loaded at another block say 720. This answers half only.

Similarly, the page mapping tables are updated for free space and space utilization and hence though the address remains same in the source code, while executing you get different values for that address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文