内存地址是什么意思?
十六进制内存地址是否代表整个内存中的位置?
例如 4 GB RAM,并且有一个内存地址。它是否指向数据开始的位置(以字节为单位)?例如 2.1 GB。
在数据加载到内存之前,内存地址如何在硬盘上工作?
是否存在部分数据从内存中获取而其他数据从磁盘中获取的情况?地点如何区分?
谢谢
Does a hex memory address represent the position in the memory as a whole?
e.g. 4 gb ram and there is a memory adress. Does it point to the position(in bytes) that the data starts at? e.g. at 2.1 gb.
How do memory address work on hard disk before the data is loaded into memory?
Is there ever a case where parts of the data are fetched from memory and other data is fetched from disk? How are the locations differentiated?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
十六进制内存地址(就像打印出指针的值时看到的那样)指向虚拟内存中的位置。
在32位系统上,每个进程都有完整的4GB虚拟内存。该虚拟内存由 CPU 和操作系统管理。当您访问虚拟内存中的某个位置时,CPU 和操作系统会确定该位置映射到系统实际物理内存中的哪个位置,并从那里检索数据。
操作系统还可能从物理内存中取出内容并将其交换到磁盘,以便为其他内容腾出物理内存空间。然后,如果您尝试访问从物理内存交换到磁盘的某些内容的虚拟内存位置,则会生成“页面错误”,导致操作系统将页面从磁盘重新加载到物理内存中。
A hex memory address (like what you would see if you printed out the value of a pointer) points to a location in virtual memory.
On a 32 bit system, each process has a full 4GB of virtual memory. This virtual memory is managed by the CPU and the operating system. When you access a location in virtual memory, the CPU and operating system determine where in the systems actual physical memory that location is mapped, and the data is retrieved from there.
The operating system may also take things out of physical memory and swap them to disk, in order to make room in physical memory for other things. Then, if you try to access the virtual memory location of something that was swapped from physical memory to disk, a "page fault" is generated which causes the OS to re-load the page from disk into physical memory.
现代操作系统具有虚拟内存。
这意味着使用程序访问内存中某些字节的地址纯粹是“虚拟”的,不存在的。操作系统通过特殊的硬件控制器将其映射到完全不同的真实内存位置,并且对于给定地址可能根本没有物理内存位置。例如,您可以 mmap() 将文件放入(虚拟)内存,并访问位于虚拟地址意味着访问一个文件字节。同样,如果某个内存页面长时间未使用,操作系统可以交换页面从物理RAM到磁盘。在这种情况下,虚拟内存也不会指向物理内存位置。
Modern operating systems have virtual memory.
This means that the address which uses your program to access some byte in memory, is purely "virtual", non-existent. The operating system maps it via special hardware controllers to real memory locations which are completely different and there may be no physical memory location at all for a given address. For example, you may mmap() a file into (virtual) memory, and accessing a byte at the virtual addresses would mean accessing a byte of file. Similarly, if some memory page wasn't used for a long time, the OS may swap off the page from physical RAM to disk. In this case virtual memory wouldn't point to physical memory locations too.
在大多数情况下 - 是的。但有些处理器使用 2 个值来计算实际地址。例如英特尔 8086。
硬盘只是存储,有自己的系统来存储信息。因此,在执行任何 CPU 操作之前,必须将数据加载到 RAM 中。
In most cases - yes. But some processors uses 2 values to calculate real address. For example Intel 8086.
Hardisk is only storage, that has its own system to store information. So before any CPU operation is executed, data has to be loaded into RAM.