内存映射,虚拟内存_内存映射和虚拟内存的概念

内存映射,虚拟内存

内存映射和虚拟内存的概念 (Memory Mapping and Concept of Virtual Memory)

The transformation of data from main memory to cache memory is called mapping. There are 3 main types of mapping:

数据从主内存到高速缓存的转换称为映射。 映射有3种主要类型:

  • Associative Mapping

    关联映射
  • Direct Mapping

    直接映射
  • Set Associative Mapping

    设置关联映射

关联映射 (Associative Mapping)

The associative memory stores both address and data. The address value of 15 bits is 5 digit octal numbers and data is of 12 bits word in 4 digit octal number. A CPU address of 15 bits is placed in argument register and the associative memory is searched for matching address.

关联存储器存储地址和数据。 15位的地址值为5位八进制数,数据为12位字(4位八进制数)。 将15位的CPU地址放入自变量寄存器,并在关联存储器中搜索匹配的地址。

内存映射,虚拟内存_内存映射和虚拟内存的概念

直接映射 (Direct Mapping)

The CPU address of 15 bits is divided into 2 fields. In this the 9 least significant bits constitute the index field and the remaining 6 bits constitute the tag field. The number of bits in index field is equal to the number of address bits required to access cache memory.

15位的CPU地址分为2个字段。 在此,9个最低有效位构成索引字段,其余6个位构成标签字段。 索引字段中的位数等于访问高速缓存所需的地址位数。

内存映射,虚拟内存_内存映射和虚拟内存的概念

设置关联映射 (Set Associative Mapping)

The disadvantage of direct mapping is that two words with same index address can't reside in cache memory at the same time. This problem can be overcome by set associative mapping.

直接映射的缺点是具有相同索引地址的两个字不能同时驻留在高速缓存中。 可以通过集合关联映射来克服此问题。

In this we can store two or more words of memory under the same index address. Each data word is stored together with its tag and this forms a set.

在这种情况下,我们可以在相同的索引地址下存储两个或多个内存字。 每个数据字都与其标签一起存储,从而形成一个集合。

内存映射,虚拟内存_内存映射和虚拟内存的概念

替换算法 (Replacement Algorithms)

Data is continuously replaced with new data in the cache memory using replacement algorithms. Following are the 2 replacement algorithms used:

使用替换算法,用高速缓存中的新数据连续替换数据。 以下是使用的2种替换算法:

  • FIFO - First in First out. Oldest item is replaced with the latest item.

    FIFO-先进先出。 最旧的项目替换为最新的项目。
  • LRU - Least Recently Used. Item which is least recently used by CPU is removed.

    LRU-最近最少使用。 CPU最近使用最少的项目被删除。

虚拟内存 (Virtual Memory)

Virtual memory is the separation of logical memory from physical memory. This separation provides large virtual memory for programmers when only small physical memory is available.

虚拟内存是逻辑内存与物理内存的分离。 当只有较小的物理内存可用时,这种分隔为程序员提供了较大的虚拟内存。

Virtual memory is used to give programmers the illusion that they have a very large memory even though the computer has a small main memory. It makes the task of programming easier because the programmer no longer needs to worry about the amount of physical memory available.

虚拟内存用于给程序员一种幻觉,即即使计算机的主内存很小,他们也拥有很大的内存。 由于程序员不再需要担心可用的物理内存量,因此它使编程任务变得更加容易。

内存映射,虚拟内存_内存映射和虚拟内存的概念

翻译自: https://www.studytonight.com/computer-architecture/mapping-and-virtual-memory

内存映射,虚拟内存