计算机物理内存和虚拟内存_计算机科学组织| 虚拟内存

计算机物理内存和虚拟内存

虚拟内存 (Virtual Memory)

The physical memory which we are using in our computer system is in megabytes not in gigabytes. If we try to run a program which is not completely fit into main memory, then, in this case, we try the parts of currently being executed are stored in main memory and remaining portion is stored in a secondary device such as hard disk.

我们在计算机系统中使用的物理内存是兆字节而不是千兆字节。 如果尝试运行不完全适合主存储器的程序,则在这种情况下,我们尝试将当前正在执行的部分存储在主存储器中,并将其余部分存储在辅助设备(例如硬盘)中。

If this case occurs, so it’s necessary that all parts of a program which are needed for execution are first brought into the main memory. When a new segment of a program is brought and memory is full, it must replace another segment already in the memory. So the techniques which are used to move program and data block into the main memory when they required for execution are called virtual memory techniques.

如果发生这种情况,那么有必要将程序执行所需的所有部分都首先放入主存储器。 当程序的新段被引入并且内存已满时,它必须替换内存中已经存在的另一个段。 因此,用于在程序和数据块需要执行时将程序和数据块移入主存储器的技术称为虚拟存储器技术

虚拟内存组织 (Virtual Memory Organization)

Virtual Memory in CSO
  • Programmers discern a larger memory which is allocated on the disk this memory is referred to as virtual memory. A programmer enjoys a huge virtual space to develop his or her program or software.

    程序员可以看到分配在磁盘上的更大内存,该内存称为虚拟内存 。 程序员享有巨大的虚拟空间来开发其程序或软件。

  • Program or a processor references a data space which is independent of available physical memory space. The address issued by a processor is called a virtual address.

    程序或处理器引用独立于可用物理内存空间的数据空间。 处理器发出的地址称为虚拟地址。

  • The virtual address can be translated into the physical address by a combination of hardware and software components.

    可以通过硬件和软件组件的组合将虚拟地址转换为物理地址。

  • If a virtual address is a part of the program in the physical memory then it can be accessed immediately and if the address is not in the main memory then its content will be brought into the main memory before it can be used.

    如果虚拟地址是物理内存中程序的一部分,则可以立即对其进行访问;如果该地址不在主内存中,则其内容将被带入主内存,然后才能使用。

  • To improve the performance hardware are added to the system, these hardware units are known as Memory Management Unit (MMU).

    为了提高性能,将硬件添加到系统中,这些硬件单元称为内存管理单元(MMU)。

  • In the paging system, page table helps us to find the physical address form virtual address since the virtual address space is used to develop a process. So the work of the MMU is to translate the virtual address to physical address.

    在分页系统中,页面表可帮助我们从虚拟地址中查找物理地址,因为虚拟地址空间用于开发流程。 因此,MMU的工作是将虚拟地址转换为物理地址。

分页和虚拟内存地址转换 (Paging and Virtual Memory Address Translation)

The mechanism for reading a data from memory involves translation of virtual address to physical address. In this basically, the concept of paging is used for doing the translation. Following steps are there for address translations which are given below:

从存储器读取数据的机制涉及虚拟地址到物理地址的转换。 从根本上讲,使用分页的概念进行翻译。 以下是地址转换的以下步骤:

  1. Virtual address space of the program is divided into fixed length units called, pages.

    程序的虚拟地址空间分为固定长度的单元,称为页面。

  2. Each page will contain a block of words that will occupy the locations in the main memory. After this, each page will be mapped into the fixed location in the main memory called page frame.

    每个页面将包含一个单词块,这些单词块将占据主内存中的位置。 此后,每个页面将被映射到主存储器中称为页面框架的固定位置。

  3. The address generated by the processors to fetch the word memory can be divided into the two parts:

    处理器为获取字存储器而生成的地址可以分为两部分:

  4. Virtual Memory in CSO


  5. In this case, high order bits are interpreted as virtual page number and these bits are used to fetch corresponding page frame number from the page table.

    在这种情况下,高阶位被解释为虚拟页号,并且这些位用于从页表中获取相应的页帧号。

  6. Low order bits of the address gives the offset and it specifies as the particular byte within in a page.

    地址的低位给出偏移量,并指定为页面中的特定字节。

  7. By adding this virtual page number to the contents of the content page table, the address of the corresponding entry in the page table is obtained.

    通过将此虚拟页码添加到内容页表的内容中,可以获得页表中相应条目的地址。

  8. Each entry in a page includes a control bit that describes a validity of a page, the status of the page, and whether the page has been modified.

    页面中的每个条目都包含一个控制位,该控制位描述页面的有效性,页面的状态以及页面是否已被修改。

虚拟内存的优势 (Advantages of virtual memory)

  1. A process which is larger than the main memory, it will be executed because of the demand paging.

    由于需求分页,将执行比主存储器大的进程。

  2. By the concept of a virtual memory, many processes can be maintained in the main memory.

    通过虚拟内存的概念,可以在主内存中维护许多进程。

  3. It will allow greater programming level by using only less space for a particular process.

    通过为特定过程仅使用较少的空间,将允许更高的编程级别。

翻译自: https://www.includehelp.com/cso/virtual-memory.aspx

计算机物理内存和虚拟内存

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值