ComputerArchitecture计算机系统结构知识点详解
Computer Architecture计算机系统结构
1. Fundamentals of Computer Architecture 计算机系统结构的基本原理
1.1 Layers of Computer System计算机的层次
Application Language Machine M5 应⽤语⾔机
High-Level Language Machine M4 ⾼级语⾔机
Assembly Language Machine M3 汇编语⾔机
Operating System Machine M2 操作系统机
Conventional Machine M1 传统机
Microprogram Machine M0 微程序机
1. 每个层次执⾏相关的功能⼦集。
2. 每个层次要依赖于下⼀个低层去执⾏更原始的功能。
3. 这就将问题分解成更易处理的⼦问题。
4. 从M2到M5的层次是虚拟机。
5. 在传统机上的指令(算数、逻辑等)由微程序级的程序实现。该程序是作为⼀个解释器,能理解⼀组简单的操作集合,称为微指令集。
1.2 Computer Architecture and Implementation计算机的系统结构和实现
Computer Architecture 计算机系统结构
Refers to those attributes of a system visible to a programmer, or those attributes have direct impact on logical execution of program.程序员可见,或者对程序执⾏有直接影响的属性
Implementation 实现
Two components: Organization and hardware. 两个组件:组织和硬件
1. Organization(组织): includes high-level aspects of a computer’s design, such as: memory system,
bus structure, internal CPU. 组织(组织):包括⾼级⽅⾯的计算机的设计,如:内存系统,总线结构、内部CPU。
2. Hardware(硬件): refers to the specifics of a machine, include: detailed logic design and packaging technology. 硬件(硬件):指机器的细节,包括:详细的逻辑设计和包装技术。
Architectural Attributes 系统结构⽅⾯的属性
instruction set, 指令集
I/O mechanisms, I/O机制
techniques for addressing memory 寻址技术
number of bits representing various data type(numbers, characters) 表⽰各种数据类型的位数(数值、字符) Organizational Attributes 组织⽅⾯的属性
Hardware details transparent to the programmer.对于程序透明的硬件细节
such as: control signals 控制信号computer/peripheral interfaces 计算机/外设接⼝memory technology 存储技术
Hardware Attributes 硬件⽅⾯的属性
packaging technology 封装技术
cooling 冷却
Architectural Design Issue 系统结构设计问题
Whether a computer will have a multiply instruction.是否要有⼀个乘法指令
Organizational Issue 组织设计问题
1. Whether the instruction will be implemented by a special multiply unit or by repeated use of
the add unit. 是采⽤乘法单元还是采⽤加法单元迭代使⽤
2. The decision may be based on the anticipated frequency of use of the multiply instruction, the relative speed of the two approaches, and the cost and physical size of a special multiply unit. 决策取决于乘法指令使⽤频率,两种⽅法的相对速度,乘法单元的成本和⼤⼩
1.3 The Task of A Computer Designer计算机设计者的任务
Determine what attributes are important for a new machine. 确定哪些属性是重要的Design a machine to maximize performance (性能) while staying within cost (成本) and power(功耗) constraints,设计⼀台机器来最⼤化性能,并保持在成本和⼒量约束
including: instruction set design 指令集设计,functional organization 功能设计,logic design 逻辑设计,implementation(实现): IC design, package, cooling
They have to determine the functional requirements: major task: 功能需求是主要的
look for1. The requirements may be specific features inspired by the market. 由市场决定的某个特性
2. Application software often drives the choice of certain functional requirements.应⽤软件驱动
3. The presence of a large market for a particular class of applications might encourage the designers to incorporate requirements. 应⽤驱动
1.4 Measuring and Reporting Performance测量和报告性能
When we say one computer is faster than another, what do we mean? 快的涵义?
The user may say a computer is faster when a program runs in less time. ⽤户:程序运⾏时间短the computer center manager may say a computer is faster when it completes more jobs in an hour. 计算机中⼼经理:在⼀⼩时内做更多⼯作
1. response time (响应时间)—The computer user is interested in reducing
2. execution time (执⾏时间)—the time between the start and the completion of an event
3. throughput (吞吐量)—the total amount of work done in a given time.
X⽐Y快n倍:n=Ex ecution time Y
Ex ecution time X
=Performance Y
Performance X
n=执⾏时间Y
如何写好看的字执⾏时间
X
=性能Y
性能
X
1性能
Measuring Performance 测量性能
Even execution time can be defined in different ways: 执⾏时间的不同定义
wall-clock time, response time, or elapsed time, which is the latency to complete a task, including disk accesses, memory accesses, input/output activities, operating system overhead.时钟时间、响应时间,或运⾏时间,这是延迟完成⼀个任务,包括磁盘访问,内存的访问、输⼊/输出,操作系统开销。
CPU time (CPU时间):means the time CPU is computing, not including the time waiting for I/O or ru
nning other programs. CPU时间:是指CPU计算时间,其中还不包括时间等待I / O或运⾏其他程序。
CPU time can be further divided into: CPU时间可以进⼀步分为:
1. user CPU time (⽤户CPU时间):the CPU time spent in the programCPU花在这个程序的时间
2. system CPU time (系统CPU时间):the CPU time spent in the operating system performing tasks requested by the program, called).CPU花在操作系统执⾏任务所要求的项⽬
Choosing Programs to Evaluate Performance选择程序来评估性能
Four levels of programs listed below in decreasing order of accuracy of prediction. 四个层次的程序, 按精确度从⾼到底的次序
1. Real applications 真实应⽤input, output, and options 有输⼊、输出、可选项
2. Kernels 核⼼程序key pieces 关键⽚段最便于辨析出机器单个特性的性能西式婚礼流程
3. Toy benchmarks 玩具测试基准
4. Synthetic benchmarks 合成测试基准匹配程序中操作和操作数的平均频率
Benchmark Suites 测试基准程序
1. put together collections of benchmarks to measure the performance of processors with a variety of applications 把集合的基准来测量性能的处理器与各种应⽤程序
2. A key advantage of such suites is that the weakness of one benchmark is lessened by the presence of other benchmarks 互补
3. Benchmark suits are made of collections of programs, some of which may be kernels, but many of which are typically real programs 有些是核⼼程序, 但很多是真实程序
Reporting Performance Results 报告性能结果
1. The guiding principle of reporting performance measurements should be reproducibility 报告的指导原则的性能测量应再现性
2. requires a fairly complete description of the machine, the compiler flags, as well as the publication of both the baseline and optimized results 需要⼀个相当完整的描述机器,编译器标志,以及出版的两个基线和优化结果
3. contains the actual performance times, shown both in tabular form and as a graph 包含实际的表现时期,显⽰两个表格形式和图表
Comparing and Summarizing Performance ⽐较和总结性能
battles are fought over what is the fair way to summarize relative performance of a collection of programs. 什么是公平的⽅法:竞争
Total Execution Time: A Consistent Summary Measure 总体执⾏时间
This summary tracks execution time, our final measure of performance.执⾏时间:最终性能度量 An average of the execution time is the arithmetic mean: 平均执⾏时间1n time i n i =1
Weighted Execution Time 加权执⾏时间
第⼀种⽅法:对每个程序赋予权值
weighted arithmetic mean: 加权算数平均值 Weig?t i ×Time i n i =1
Normalized Execution Time and the Pros and Cons of Geometric Means
归⼀化执⾏时间,以及⼏何平均值的优劣
第⼆种⽅法:利⽤归⼀化的执⾏时间
实际性能=归⼀化数×参考机性能
Average normalized execution time can be expressed as either an arithmetic or geometric mean. 可采⽤算数或⼏何平均值Execution time ratio i n i =1n
⼏何平均值的好性质:⼏何平均值的⽐率与⽐率的⼏何平均值相同
Geometric mean (X i )i =Geometric mean (X i i
) In contrast to arithmetic means, geometric means of normalized execution times are consistent no matter which machine is the reference. Hence, the arithmetic mean should not be used to. ⽆论采⽤哪个机器作为参考机,归⼀化执⾏时间的⼏何平均值都是⼀致的。故不应采⽤算数平均值。
harmonic mean ≤geometric mean ≤ arithmetic mean 调和均值≤⼏何均值≤算数均值
1. Advantage: geometric mean is independent of the running times of individual programs, and it
doesn’t matter which machine is used to normalize. 优点:与各个程序运⾏时间⽆关,与采⽤哪⼀个机器进⾏归⼀化⽆关2. Drawback: geometric means violate our fundamental principle of performance measurement —they do not predict execution time. 缺点:违反了性能测量的基本原理
1.5 Quantitative Principles of Computer Design计算机设计的量化原理
Make Common Case Fast 使常见情况更快
照顾经常发⽣的情况
Amdahl’s Law 阿姆达尔定律
⽤途:The performance gain obtained by improving some portion of a computer can be calculated using Amdahl’s Law得到的性能改善的⼀部分电脑可以计算使⽤Amdahl法则
定义:Amdahl’s Law states that the performance improvement to be gained from using some faster mode of execution is limited by the fraction of the time the faster mode can be used. 阿姆达尔定律的涵义:由某些部分加速所得到的性能提⾼受加速部分的百分率所限。
加速⽐:Speedup=系统性能
改进后
系统性能
改进前
=总执⾏时间改进前
总执⾏时间
改后前
加速⽐取决于两个因素:
1. 能加速的部分Fraction enhanced≤1
2.能加速的程度Speedup enhanced≤1
总执⾏时间
改进后=总执⾏时间
改进前
×[1?可改进⽐例+
可改进⽐例
部件加速⽐
]
系统加速⽐=总执⾏时间
改进前
穿越火线网剧总执⾏时间
改进后
=
1
1?可改进⽐例+可改进⽐例
部件加速⽐
回报递减法则:Amdahl’s Law expresses the law of diminishing returns : The incremental improvement in speedup gained by an additional improvement in just a portion of the computation diminishes as improvements are added. 对于⼀部分性能的提⾼,总体加速⽐的提⾼呈递减
推论:An important corollary of Amdahl’s Law is that if an enhancement is only usable for a fraction of a task, we can’t speed up the task by more than the reciprocal of 1 minus that fraction. 总体加速⽐有上界
The CPU Performance Equation CPU性能⽅程
两种表达⽅式:CPU时间=总时钟周期数×时钟周期=总时钟周期数
时钟频率
CPI(每条指令时钟数)=总时钟周期数IC(指令数)
执⾏时间公式:总CUP时间=CPI×IC×时钟频率=CPI×IC
时钟频率
CPU performance is dependent upon : clock cycle (or rate), CPI, and IC。CPU性能取决于:时钟周期(或⽐率),CPI,IC
很难改变⼀个参数⽽不影响其它参数:
1. Clock cycle time -- Hardware technology and organization时钟周期:硬件技术和组织
大昭寺2. CPI -- Organization and ISA CPI:组织和ISA(指令系统)
3. Instruction count -- ISA and compiler technology IC:指令系统和编译器技术
Measuring the Components of CPU Performance测量CPU性能的各组成部分
To determine the clock cycle: 确定时钟周期
1. is easy for an existing CPU. 现有CPU:容易
2. Low-level tools, called timing estimators or timing verifiers, are used for a completed design.
已完成:⽤时延估计器或时延验证器
七情六欲指什么3. for a design that is not completed, by examining the critical paths in a design.
未完成;⽤关键路径
发布评论