当前位置:网站首页>[parallel and distributed systems] cache learning
[parallel and distributed systems] cache learning
2022-06-11 02:20:00 【I'll carry you】
List of articles
We share 8 That's ok cache line,cache line Size is 8 Bytes. So we can take advantage of the low address 3 bits( As shown in the blue part of the address above ) Used to address 8 bytes A byte in the , We call this part bit Combination for offset. Empathy ,8 That's ok cache line, To cover all rows . We need to 3 bits( As shown in the figure above, the yellow part of the address ) Find a row , This part of the address is called index. Now we know that , If two different addresses , Of its address bit3-bit5 If exactly the same , Then the two addresses will find the same after hardware hashing cache line. therefore , When we find cache line after , It only represents the data corresponding to the address we access. There may be this cache line in , But it may also be the data corresponding to other addresses . therefore , We introduce tag array Area ,tag array and data array One-to-one correspondence . every last cache line All correspond to the only one tag,tag The whole address bit width is saved in index and offset The use of bit rest ( As shown in the figure above, the green part of the address ).tag、index and offset The combination of the three can uniquely determine an address . therefore , When we according to the address index A find cache line after , Take out the current cache line Corresponding tag, And then... In the address tag Compare , If equal , This explanation cache hit . If it's not equal , Show the current cache line It stores data from other addresses , This is it. cache defect . In the figure above , We see tag The value of is 0x19, And... In the address tag Partially equal , So this visit will hit . because tag The introduction of , So it answers our previous question “ Why hardware cache line Not made into a byte ?”. This will lead to an increase in hardware costs , Because the original 8 One byte corresponds to one tag, Now need 8 individual tag, Takes up a lot of memory .tag It's also cache Part of , But we talked about cache size I don't think about tag The part of memory occupied .We can see from the picture tag There's another one next to it valid bit, This bit Used to represent cache line Whether the data in is valid ( for example :1 Means effective ;0 Is invalid ). When the system just started ,cache The data in should be invalid , Because you haven't cached any data yet .cache The controller can be controlled according to valid bit Confirm current cache line Is the data valid . therefore , The above comparison tag confirm cache line It will also be checked before hitting valid bit Whether it works . Only if it works , Compare tag It makes sense . If an invalid , Direct determination cache defect .
In the example above ,cache size yes 64 Bytes also cache line size yes 8 bytes.offset、index and tag Separate use 3 bits、3 bits and 42 bits( Suppose the address width is 48 bits). Now let's look at another example :512 Bytes cache size,64 Bytes cache line size. According to the previous address division method ,offset、index and tag Separate use 6 bits、3 bits and 39 bits. As shown in the figure below .
边栏推荐
- Introduction and practice of QT tcp/udp network protocol (supplementary)
- 2022 simulated 100 questions and answers for crane driver (limited to bridge crane) examination
- During SSH configuration key login, you need to pay attention to whether the private key is set with a password
- Sequence table exercises
- cannot import name ‘dtensor‘ from ‘tensorflow. compat. v2.experimental‘
- [3.delphi common components] 7 timer
- 软件测试面试复盘:技术面没有难倒我,hr面却是一把挂
- Using an old mobile phone to build a server and achieve intranet penetration does not require root (I have personally tested the simplest one many times)
- Analysis of common ADB commands
- Jump without refresh - detailed explanation of pushstate and replacestate methods in history
猜你喜欢

技术分享| 快对讲,全球对讲

Tencent test development post interview programming questions

Analysis of common ADB commands

SAP SMARTFORMS换页打印自动判断
![[3.delphi common components] 5 List class component](/img/c0/33b1903c73840b350fea1740eade5e.jpg)
[3.delphi common components] 5 List class component

SAP smartforms text content manual wrap output

金属有机框架MOF-Al(DIBA),MOF-Zr(DIBA),MOF-Fe(DIBA)包载姜黄素/羧苄西林/MTX甲氨蝶呤/紫杉醇PTX/阿霉素DOX/顺铂CDDP/CPT喜树碱等药物

SAP smartforms page feed printing automatic judgment

Using an old mobile phone to build a server and achieve intranet penetration does not require root (I have personally tested the simplest one many times)

Secret
随机推荐
ABAP CDs realizes multi line field content splicing
MD61计划独立需求导入BAPI【按日维度/动态模板/动态字段】
Byte beating client R & D Intern Tiktok side
NFT insider 61:animoca brands holds US $1.5 billion of encrypted assets in 340 investments
aspects to consider for a recommendation letter
SAP SMARTFORMS文本内容手动换行输出
[3.delphi common components] 5 List class component
Can the soft exam certificate be settled in Shanghai? Many people don't know
常见漏洞的防御措施整理
优化调度(火电、风能、储能)【matlab代码实现】
Complete tutorial on obtaining voltage from QGC ground station (APM voltage cannot be obtained from QGC)
Polynomial multiplication
Binary tree sequence traversal
English subtitle video translated into Chinese subtitles
[C language] storage of data in memory -1 plastic
从测试零基础到测试架构师,这10年,他是这样让自己成才的
Fallible point--
[3.delphi common components] 6 scroll bar
Internet of things final assignment - sleep quality detection system (refined version)
[winning] Title A of the 9th Teddy Cup Challenge
