在应用符号在C / C ++或以任何其他这样的语言变量或数据类型返回什么类型的地址?

在应用符号在C / C ++或以任何其他这样的语言变量或数据类型返回什么类型的地址?

问题描述:

这是一个非常基本的问题令人难以置信的头脑,因为我听说过虚拟和物理内存的概念在我的OS类概念的那一天。现在我知道,在加载时和编译时,虚拟地址和逻辑ADRESS约束力的方案是相同的,但在执行时它们之间的区别。

This is a very basic question boggling mind since the day I heard about the concept of virtual and physical memory concept in my OS class. Now I know that at load time and compile time , virtual address and logical adress binding scheme is same but at execution time they differ.

首先,为什么是它有利于产生在编译和加载时间的虚拟地址,当我们运用符号运算符来获得一个变量的地址,天真的数据类型,用户定义类型和函数定义的地址返回什么?

First of all why is it beneficial to generate virtual address at compile and load time and and what is returned when we apply the ampersand operator to get the address of a variable, naive datatypes , user-defined type and function definition addresses?

和如何做OS究竟地图从虚拟到物理地址时,它这样做?这些问题是从华中科技大学出于好奇,我很想一些很好的深入分析考虑现代操作系统,在如何早期的操作系统是它的。我是唯一的C ​​/ C ++特定的,因为我不知道很多关于其他语言。

And how does OS maps exactly from virtual to physical address when it does so? These questions are hust out from curiosity and I would love some good and deep insights considering modern day OS' , How was it in early days OS' .I am only C/C++ specific since I don't know much about other languages.

物理地址发生于硬件,而不是软件。一个可能的/偶然的例外是在操作系统内核。物理意味着它是该系统总线和RAM芯片看到的地址

Physical addresses occur in hardware, not software. A possible/occasional exception is in the operating system kernel. Physical means it's the address that the system bus and the RAM chips see.

不仅是无用的软件物理地址,但它可能是一个安全问题。能够没有地址转换访问任何物理存储器,并知道其他进程的地址,将允许对机器不受阻碍地进入

Not only are physical addresses useless to software, but it could be a security issue. Being able to access any physical memory without address translation, and knowing the addresses of other processes, would allow unfettered access to the machine.

这是说,较小的或嵌入机器可能没有虚拟内存,而一些老的操作系统确实允许共享库指定其最终的物理存储位置。这样的政策伤害了安全性和已过时。

That said, smaller or embedded machines might have no virtual memory, and some older operating systems did allow shared libraries to specify their final physical memory location. Such policies hurt security and are obsolete.