简体   繁体   English

我对虚拟地址和物理地址感到困惑

[英]I am confusing on virtual address and physical address

Multiple virtual addresses can map to a single physical address ----from Wikipedia. 多个虚拟地址可以从Wikipedia映射到单个物理地址。

if my base address of code segment and data segment at the same 0, the segments how to map to physical address? 如果我的代码段的基地址和数据段的基地址相同为0,则这些段如何映射到物理地址?

This is the concept of Virtual memory. 这是虚拟内存的概念。
The user process is divided into many pages. 用户进程分为许多页面。
Even the main memory is divided into many frames such that the size of each frame is equal to the size of each page. 甚至主存储器也被分成许多帧,使得每个帧的大小等于每个页面的大小。

When a process is run, the entire program is not required but only some parts. 运行某个进程时,不需要整个程序,而只需要某些部分。 So only those pages are loaded into the memory which are required at that instance of time. 因此,只有那些在该时间实例所需的页面被加载到内存中。 Later when they are not required, they are replaced by other pages. 稍后,当不需要它们时,它们将被其他页面替换。

Now this mapping of a page to the frame in the main memory is kept in a data structure called Page Table. 现在,页面到主存储器中的帧的映射被保存在称为页面表的数据结构中。

CPU always generates virtual address and the memory management unit translates this address to physical address using the page table. CPU始终生成虚拟地址,并且内存管理单元使用页表将该地址转换为物理地址。

Get segments out of your vocabulary. 从您的词汇表中获取细分。

Physical memory is divided into page frames. 物理内存分为页面框架。 The size of a page frame varies amount systems but is usually between 512bytes and 4K bytes. 页帧的大小随系统数量的不同而不同,但通常在512字节和4K字节之间。

Each process has a logical address space consisting of an array of pages. 每个进程都有一个由页面数组组成的逻辑地址空间。 The size of a page is the same as the size of a page frame. 页面的大小与页面框架的大小相同。

Each process has a PAGE TABLE that contains mappings between logical pages and physical page frames. 每个进程都有一个PAGE TABLE,其中包含逻辑页面和物理页面框架之间的映射。

Nothing (other than the operating system) prevents multiple page table entries from mapping to the same page frame. 除了操作系统,其他任何内容都不能阻止多个页面表条目映射到同一页面框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM