CHAPTER 1 ----- a tour of computer sysytems(2)

1.3 It pays to understand how compilation systems work

Why programmers need to understand how compilation systems work?

1)Optimizing program performance.We do need a basic understanding of machine-level code and how the compiler translation different C statements into machine code.

chapter 3 ———how compilers translate different C constructs into these languages.

chapter 5———making simple transformations to the C code that help the compiler do its job better.

chapter 6———learn the hierarchical nature of the memory system,how C compilers store data arrays in memory and how your C programs can exploit this knowledge to run more efficiently.

2)Understanding link-time errors(链接时出现的错误).———chapter 7

3)Avoiding secuirty holes.Buffer overflow vulnerabilities (缓冲区溢出错误)have accounted for the majority of security holes in network and Internet servers. Too few programmers undertand the need to carefully restict the quatity and forms of data they accept from untrusted sources.A first step in learning secure programming is to understand the consequences of the way data and control information are stored on the program stack.

chapter 3———We cover the stack discipline and buffer overflow vulnerabilities as part of our study of assembly language.

1.4 Processors read and interpret instructions stored in memory

The shell(an application program) is a command-line interpreter that prints a prompt(提示符,即"linux>"),waits for you to tpye a command line,and then performs the commond.The shell loads and runs the hello program and then waits for it to terminates(because hello is not a built-in shell command).The shell then prints a prompt and wait for the next input command line.

1.4.1Hardware organization of a system

CPU:Central processing Unit;ALU:Arithmetic/Logic unit;PC:Program counter;USB:Universal Serial Bus.

Buses:Running throughtout the system is a collection of electrical conduits(电缆/电子通道) called buses that carry bytes of information back and forth between the components.Buses are typically designed to transfer fixed-sized chunks of bytes known as words.

贯穿整个系统的是一组电子管道,称为总线,他携带信息字节并负责在各个部件间传递。

I/O devices:Input/output(I/O)devices are the system‘s connection to the external world.Each I/O devices is connected to the I/Obus by either controller or an adapter.The distinction between the two(controller and adapter) is mainly one of packaging(封装方式).Controller are chip sets in the device itself or on the system‘s main printed circuit board (often called motherboard主板).An adapter is a card that plugs into a slot on the motherboard. Regardless,the purpose of each is to transfer information back and forth between the I/O bus and I/O device.

Main memory:it is a temporary storage device that holds both a program and the data (that) it manipulates while the processor is executing the program.Physically,main memory consist of a collection of(一组) dynamic random access memory(DRAM)chips.Logically,memory is organized as a linear array of bytes(一个线性字节数组),each with its own unique address (array index 数组索引)starting at zero(这些地址是从零开始的).

Processor:the central processing unit(CPU)is the engine that interprets(or executes)instructions stored in main memory.At its core is a word-sized storage device(or register)called the program counter(PC).At any point in time,the PC points at (contains the address of )some machine-language instrcution in main memory.

处理器是解释(执行)存储在主存中指令的引擎,处理器的核心是一个大小为1个字的存储设备(寄存器),称为程序计数器(PC)。在任何时刻,PC都指向主存中的一条机器语言的指令(即含有该指令的地址)。

A processor reads the instruction from memory pointed at by the program counter(PC),interprets the bits in the instruction,performs some simple operation dictated by the instruction(执行该指令指示的简单操作),and then updates the PC to point to the next instruction,according ot its instruction set architecture.

the simple operation :Load:copy a byte or a word from main memory into a register,overwriting(覆盖) the previous contents of the register;store:copy a byte or a word from a register to a location in main memory(主存的某个位置),overwriting the previous contents of that location;operate:copy the contents of two register to the ALU,perform an arithmetic operation on the two words,and store the result in a register,overwriting the previous contents of that register,jump:extract a word from the instrunction itself (从指令本身提取一个字)and copy that word into the PC,overwriting  the previous value of the PC.

We can distinguish the processor‘s instruction set architecture,describing the effect of each machine-code instruction,from its microarchitecture,describing how the processor is actually implemented.

我们将处理器的指令集架构和处理器的微体系结构区分,前者描述的是每条机器代码指令的效果,后者描述的是处理器实际的实现方式。

1.4.2Running the hello program

command from the keyboard:

load hello(Using a technique known as direct memory access,DMA,the data travels directly from disk to main memory,without passing throught the processor ):

execute:string from memory to the register file ,and from there to the display device.

1.5Caches Matter

To deal with the processor-memory gap,system designers include smaller faster storage devices called cache memories that serve as temporary staging areas for informaiton that the processor is likely to need in the near future.An L1cache on the processor chip holds tens of thousands of bytes and can be accessed nearly as fast as the register file.A larger L2 cache with hundreds of thousands to millions of bytes is connected to the processor by a special bus.It may take 5 times longer for the process to access the L2 cache than the L1 cache,but this is still 5 to10 times faster than accessing the main memory.

L1 and L2 caches are implemented with a hardware technology known as static random access memory(SRAM).some have three levels of caches:L1,L2 and L3.

The idea behind caching is that a system can get the effect of both a very large memory and a very fast one by exploiting locality,the tendency for programs to access data and code in localized regions.

1.6 Storage devices form a hierarchy

The main idea of a memory hierarchy is that storage at one level serves as a cache for storage at the next lower level.上一层的存储器作为低一层存储器的高速缓存。

原文地址:https://www.cnblogs.com/SsoZhNO-1/p/8832192.html

时间: 2024-10-17 08:17:20

CHAPTER 1 ----- a tour of computer sysytems(2)的相关文章

CS:APP CH01.A Tour of Computer Systems

程序语言到机器指令的过程 1.hello.c 源程序一个文本文件 经过预处理(pre-processer)成为 hello.i 2.hello.i 修改的源程序 经过编译处理(compiler) 成为 hello.s 3.hello.s 汇编程序 经过汇编器(assembler) 成为 hello.o 4.hello.o 一个二进制文件+printf.o 经过链接器(linker) 成为可执行文件(executable) hello 原文地址:https://www.cnblogs.com/Ge

1.17

Computer Systems A Programmer's Perspective  -Bryant O'Hallaron Chapter 1. A Tour of Computer Systems 1.8 Systems Communicate With Other Systems Using Networks 1.9 Important Themes 1.9.1 Concurrency and Parallelism 1.9.2 The Importance of Abstraction

【转帖】Bootleg recording

Bootleg recording From Wikipedia, the free encyclopedia For other uses, see Bootleg (disambiguation). The audio cassette greatly increased the distribution of bootleg recordings in the 1980s. A bootleg recording is an audio or video recording of a pe

常见计算机英语单词

1. file n. 文件:v. 保存文件 2. command n. 命令指令 3. use v. 使用用途 4. program n. 程序 5. line n. (数据程序)行线路 6. if conj. 如果 7. display vt. 显示显示器 8. set v. 设置n. 集合 9. key n. 键关键字关键码 10. list n. 列表显示v. 打印 11. by prep. 凭靠沿 12. press v. 按压 13. with prep. 用与随着 14. forma

compiler

http://www.lingcc.com/2012/05/16/12048/ a list of compiler books — 汗牛充栋的编译器参考资料 Posted on 2012年5月16日 by Lingcc | 14 Replies 前不久,有位<编译点滴>网友询问编译器方向的参考资料.其实之前讨论过一些编译器相关的在线资料–<有写编译器的冲动?这些资料很重要>.这篇博文就来总结总结编译技术相关的各类图书资料,供各位参考.这个书列是结合本人所了解的内容整理出来的,限于

opencv2实现多张图片路线路牌检测_计算机视觉大作业2

linefinder.h同上一篇博文 main.cpp /*------------------------------------------------------------------------------------------*This file contains material supporting chapter 7 of the cookbook: Computer Vision Programming using the OpenCV Library. by Robert

Neural Networks and Deep Learning_#3

CHAPTER 1 Using neural nets to recognize handwritten digits The human visual system is one of the wonders of the world. Consider the following sequence of handwritten digits: Most people effortlessly recognize those digits as 504192. That ease is dec

UT-Austin大学在Image search and large-scale retrieval方面的一系列papers

WhittleSearch: Interactive Image Search with Relative Attribute Feedback.  A. Kovashka, D. Parikh, and K. Grauman.  International Journal on Computer Vision (IJCV), Volume 115, Issue 2, pp 185-210, November 2015.  [link]  [arxiv] Attribute Pivots for

von Neumann architecture

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION 3.1 COMPUTER COMPONENTS As discussed in Chapter 2, virtually all contemporary computer designs are based on concepts developed by John von Neumann at the Institute for Adv