内存映射文件及其实现技术_内存映射及其类型

内存映射是逻辑地址到物理内存的转换,用于内存保护和资源管理。本文介绍了三种内存映射方式:直接映射,每个主存块对应缓存中唯一位置;完全关联映射,主存块可映射到缓存任意行;集关联映射,缓存块分组形成集合,主存块可存入特定集合内的任意块。
摘要由CSDN通过智能技术生成

内存映射文件及其实现技术

内存映射 (Memory Mapping)

The translation between the logical address space and the physical memory is known as Memory Mapping. To translate from logical to a physical address, to aid in memory protection also to enable better management of memory resources are objectives of memory mapping.

逻辑地址空间和物理内存之间的转换称为内存映射 。 为了从逻辑地址转换为物理地址,以帮助进行存储器保护,还使得能够更好地管理存储器资源是存储器映射的目标。

During cache mapping, the block is not brought from the main memory but the main memory block is simply copied to the cache. Cache memory generally tends to operate in some different configurations,

在高速缓存映射期间,该块不会从主内存中带出,而是仅将主存储块复制到高速缓存中。 缓存内存通常倾向于在某些不同的配置下运行,

  1. Direct mapping

    直接映射

  2. Fully associative mapping

    完全关联的映射

  3. Set associative mapping

    设置关联映射

1)直接映射 (1) Direct Mapping)

In Direct mapped cache memory, each block mapped to exactly one location in cache memory.

在直接映射的高速缓存中,每个块都精确映射到高速缓存中的一个位置。

A particular block of main memory can map the line number of cache is given by - Cache line number = (Block Address of Main Memory) modulo (Number of lines in Cache).

主存储器的特定块可以映射高速缓存的行号,由下式给出:-高速缓存行号=(主存储器的块地址)模(高速缓存中的行数)。

Direct Mapping


Direct Mapping of Cache

缓存的直接映射

The direct-mapped cache is like rows in a table with three columns' main memory address are bits for Offset, Index, and Tag. The size of the fields depends on the capacity of memory and size of the block in the cache.

直接映射的高速缓存就像是表中具有三列主存储地址的行,分别是偏移量,索引和标记的位。 字段的大小取决于内存的容量和缓存中块的大小。

The least significant w bits are used to identify a word within a block of main memory. Tag corresponds to the remaining bits are used to determine the proper block of main memory. Line off-set or block is used to select a block to be accessed out of total blocks are available according to the capacity of the cache.

最低有效w位用于识别主存储器块中的单词。 标签对应的剩余位用于确定主存的正确块。 线偏移量或块用于根据高速缓存的容量从可用的总块中选择要访问的块。

The data block or cache line that contains the actual data fetched and stored, a tag with all or part of the address of the data that was fetched, and a flag bit that shows the presence in the row entry of a valid bit of data.

数据块或高速缓存行,其中包含已获取和存储的实际数据,带有已获取数据的全部或部分地址地址的标记以及一个标志位,该标志位显示在行条目中存在有效数据位。

2)关联映射 (2) Associative Mapping)

In this type of mapping, any main memory block can go in any line of the cache. So we have to use proper replacement policy to replace a block from the cache if the required block of main memory is not present in the cache. Here, the main memory is divided into two fields: word field identifies which word in the block is needed and the tag field identifies the block. It is considered to be the fastest and the most flexible mapping form of cache mapping.

在这种类型的映射中,任何主内存块都可以进入高速缓存的任何行。 因此,如果高速缓存中不存在所需的主内存块,我们必须使用适当的替换策略来替换高速缓存中的块。 这里,主存储器分为两个字段:字字段标识块中需要哪个字,而标签字段标识块。 它被认为是高速缓存映射的最快,最灵活的映射形式。

Associative Mapping


Associative Mapping of Cache

缓存的关联映射

3)集关联映射 (3) Set-associative Mapping)

In this mapping technique, blocks of cache are grouped to form a set and a block of main memory can go into any block of a specific set.

在这种映射技术中,缓存块被分组以形成一个集合,并且主存储器块可以进入特定集合的任何块中。

Set Associative Mapping


Set Associative Mapping of Cache

设置缓存的关联映射

This form of mapping removes the drawbacks of direct mapping. In Set-associative mapping, each word that is present in the cache can have two or more words in the main memory for the same index address. Set associative cache mapping is a combination of direct and associative cache mapping techniques.

这种映射形式消除了直接映射的缺点。 在集合关联映射中,存在于高速缓存中的每个单词在主存储器中对于相同的索引地址可以有两个或多个单词。 集合关联缓存映射是直接缓存和关联缓存映射技术的组合。

This also reduces searching overhead present in the associative mapping. Here, searching is restricted to the number of sets instead of the number of blocks.

这也减少了关联映射中存在的搜索开销。 在此,搜索仅限于组数而不是块数。

References:

参考文献:

翻译自: https://www.includehelp.com/operating-systems/memory-mapping-and-its-types.aspx

内存映射文件及其实现技术

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值