【自用】吉林大学计算机系统结构第二章:缓存优化 曲冠南老师版 笔记

VIP【自用】吉林大学计算机系统结构第二章:缓存优化 曲冠南老师版 笔记
容量8KB,2的十三次方,块大小16B,一块用掉四位,剩余2的九次方是标志位,则有512行,每个元素8B,则一块两个元素,a数组150块,b数组152块,不出现容量失效。不管是否交换内容,在同一“伪相联”组中的两块都是用同一个索引得到的,因此失效率相同,即:失效率伪相联=失效率2路。伪相联cache的命中时间等于直接映象cache的命中时间加上伪相联查找过程中的命中时间*该命中所需的额外开销。(6) 由编译器控制的预取,硬件预取的替代方法,在编译时加入预取的指令,在数据被用到之前发出预取请求。
开通可读全文 ·1.6k 人阅读
最低0.47元/天 解锁文章

文章目录

课程

在这里插入图片描述
按写分配:先处理不命中,把主存中要写的copy到cache里,然后处理写
不按写分配:不处理不命中,直接把要写的写回去
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
直接映射和二路组相联映射的不同参数:1.不命中率,直接映射的失效率高于同等情况下的组相联映射。2.周期时间,组相联映射周期时间长于直接映射(因为要比较组内的Tag位)

请添加图片描述
不太会分析cpu性能,应该是两路组相联的cpu性能好(?)

在这里插入图片描述
在这里插入图片描述
程序执行周期数就是cpu时间
在这里插入图片描述
直接映像最容易导致冲突不命中
冲突不命中的直接原因是相联度不够

VIP 缓存优化实战:从CPU缓存行到代码性能的系统级调优指南 缓存是现代计算机存储层次中的关键环节,其性能直接影响程序实际运行效率。理解缓存工作原理,需深入掌握缓存行(Cache Line)、局部性(Locality)等基础概念;其技术价值在于将抽象算法转化为可测量、可干预的物理行为——例如通过调整数据对齐、重构访问模式或插入内存屏障,直接控制硬件级数据流动。典型应用场景包括多线程伪共享规避、图像处理中的步长访问优化、嵌入式DMA缓存协同,以及哈希表等数据结构的底层性能调优。吉林大学曲冠南老师版《计算机系统结构》第二章笔记,正是一份聚焦真实硬件行为、绑定实测数据、强调 开通可读全文·223 阅读·0 点赞·3 收藏 阅读全文

相关推荐

TPU 缓存搬移开源,推理成本结构被重画|2026年11月15日

谷歌云把 TPU 上最耗时的搬运环节,做成了一个可以单独调用的库。这个库叫 TPU Sync,用 C++ 编写[① MarkTechPost]。它的做法是把云 TPU 的显存、主机内存、共享存储与数据中心网络,统一当成一个内存层级来看。对技术读者来说,价值不在性能数字,在它把推理服务的成本结构摆到了台面上。今天还有四组技术信号可以对照着看,它们分别落在运行时、权重、权限与安全四个层面。四组之间有一条线,都把控制对象往资源与权限上推。

kenshin1980的专栏 341

0x09、Redis 缓存的三种失效:穿透、击穿、雪崩的差别与拦截方案

缓存穿透、击穿、雪崩都会把请求打到数据库,但断点不同:穿透是查不存在的数据,击穿是单个热点 key 到期,雪崩是一片 key 同时失效。这篇用一张回忆图把三者钉死,给出布隆过滤器、互斥重建、过期抖动三套可跑的代码,并复盘一次 32 万 key 集中失效的线上事故。

专注于全栈开发领域 23

微信小程序消息推送实战:从模板消息到订阅消息的进阶指南

本文详细解析了微信小程序消息推送的核心机制,重点对比了模板消息与订阅消息的差异与应用场景。模板消息适用于支付成功等强即时性业务回执,而订阅消息则需用户授权,更适合物流提醒等可预期通知。文章提供了从授权、配置到发送的完整实战指南,并分享了常见的避坑技巧与性能优化建议,帮助开发者构建高效、合规的用户触达体系。

weixin_29231027的博客 600

FRM(Financial Risk Manager,金融风险管理师)知识点总结归纳

FRM知识点总结(150字) FRM考试分为两级:一级侧重基础理论和工具,包含风险管理基础、定量分析、金融市场产品、估值与风险建模四大模块,涵盖风险管理框架、统计学方法、衍生品定价及VaR计算等核心内容。二级聚焦实际应用,分为市场风险、信用风险、操作风险、流动性风险、投资管理和市场前沿六大模块,深入探讨高级风险度量技术(如极值理论)、信用风险模型、巴塞尔协议及新兴风险议题。考试体系贯穿"风险识别→度量→管理→监管"逻辑主线,强调定量分析与实务案例的结合,覆盖传统金融风险和区块链、ESG等

极客神殿 1452

Pywinauto与Inspect.exe完美搭配:解决Windows应用UI自动化中的元素定位难题

本文详细介绍了如何将Pywinauto与Inspect.exe结合,以解决Windows应用UI自动化中的核心难题——元素定位。通过实战指南,阐述了如何利用Inspect.exe在UIA模式下精准侦察控件属性,并将这些信息转化为Pywinauto的稳健定位策略,从而高效自动化WPF、WinForms等现代框架构建的复杂桌面应用。

weixin_29297127的博客 523

react-window 大数据列表和表格数据渲染组件之虚拟滚动

ReactWindow是一个高性能的React虚拟滚动组件库,专门用于高效渲染大型列表和表格数据。它通过“窗口化”技术,仅渲染用户可见区域的内容,大幅提升性能并减少内存消耗。主要特点包括:支持固定/可变大小列表项、多种布局类型(垂直/水平/网格)、轻量级设计(不足5KB)以及平滑的滚动体验。相比传统渲染方式,它能轻松处理成千上万条数据,并提供自动滚动、自适应容器大小等高级功能。与同类库相比,ReactWindow具有更简洁的API和更优的性能表现,是处理大数据量渲染场景的理想选择。

前端开发-前端技术分享 1138

保姆级教程:用Cesium的Primitive API实现火箭发射全流程动画(含代码避坑)

本文详细介绍了如何使用Cesium的Primitive API实现火箭发射全流程动画,包括模型控制、关节动画和精细时序管理。通过实战代码示例和性能优化技巧,帮助开发者高效构建高复杂度航天仿真系统,显著提升三维可视化效果与运行效率。

weixin_42565652的博客 218

运维系列【仅供参考】:微信版本过低 使用CheatEngine绕过

微信版本过低 使用CheatEngine绕过

weixin_54626591的博客 2152

ZYNQ GP总线实现PS与PL交互

3,完成 ZYNQ7 Processing System 的配置更改后,回到 Diagram 界面中,可以看到新出现了名为 M_AXI_GP0_ACLK、M_AXI_GP0 和 FCLK_CLK0 的接口,下面我们要对这些接口进行连接或引出。此处的偏移量,AXI的相邻寄存器偏移量相差4个字节,默认slv_reg0的偏移量是0,可以推导出slv_reg1,slv_reg2的偏移量分别为4和8,这里只用到了slv_reg0,所以偏移量为0。当然了,窗口数量的增加,势必会使得单个窗口的采样深度变小。

wangjie36的博客 7096

RH850从0搭建Autosar开发环境【17】- Davinci Configurator之DCM模块配置详解(下)

RH850从0搭建Autosar开发环境【17】- Davinci Configurator之DCM模块配置详解(下)

weixin_42412049的博客 2380

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 【自用】吉林大学计算机系统结构第一章:概述 曲冠南老师版 笔记
下一篇: 【自用】吉林大学计算机系统结构 第三章:指令级并行 曲冠南老师版 笔记
小白自救计划
博客等级 码龄4年 509粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址