640 likes | 810 Views
Introduction to Computer Science. By Wanshanshan wss@bucea.edu.cn. Components. 计算机基本组成. 存储器. 输入设备. 运算器. 输出设备. 控制器. 数据流. 冯 . 诺依曼思想: 二进制; 程序与数据一样存放在内存; 五大模块。. 控制流. Capabilities. All computers must perform set of tasks and provide the capability to:
E N D
Introduction to Computer Science By Wanshanshan wss@bucea.edu.cn
Components C Language Programming
计算机基本组成 存储器 输入设备 运算器 输出设备 控制器 数据流 冯.诺依曼思想: 二进制; 程序与数据一样存放在内存; 五大模块。 控制流
Capabilities • All computers must perform set of tasks and provide the capability to: • Accept input(输入), both data(数据) and instructions(指令) • Display output(输出), both textual and numerical • Store data and instructions • Perform arithmetic and logic operations on either the input or stored data • Monitor, control and direct the overall operation and sequencing of the system C Language Programming
操作码 操作数 计算机基本工作原理 1. 指令 让计算机完成某个操作发出的命令。 2. 程序 有序的指令集合。 3. 指令的执行 指令 取指周期: 内存 CPU 控制信号 CPU译码 有关部件动作 执行周期: 4. 程序的执行 CPU不断地取指令,执行指令。
指令执行过程 起始地址 自动加1 ① 程序计数器PC 0100H ⑨ 程序区 ② 指令寄存器 ③ ⑤ 译码器 控制器 ④ 操作控制线路 数据区 ⑥ ⑦ 累加器 算术、逻辑运算 ⑧ 运算器 Fundamental of Computer Information Technology
AB地址总线 DB数据总线 CB控制总线 CPU 接口 接口 只读存储器 ROM 随机存储器 RAM 输出设备 输入设备 CPU与输入输出设备的连接 常用输入设备:键盘、鼠标、扫描仪、光笔、数字化仪等。 常用输出设备:显示器、打印机、绘图仪等。
Hardware – Devices for Microcomputer • Processing: system unit • Storage • Input • Output • Communications
CPU Power PC Pentium系列芯片 ROM 内存 RAM:一条有256MB、512MB Cache:内部Cache和外部Cache。 扩展槽:用于连接其它设备。 I/O总线:ISA、EISA、PCI等。 主机 硬盘、软盘、CD-ROM或DVD-ROM等驱动器。 显示卡、声频卡等。 通用串行总线USB 电源 个人计算机硬件系统
System Board • Other components to be plugged into • Microprocessor chips • Memory chips • Bus lines • Expansion cards • Sockets and slots
Microprocessor or CPU • Where the main action takes place • Processes data and instructions • Two basic components on a microchip • Control unit • Arithmetic-logic unit
Central Processing Unit (CPU,中央处理单元) • Control unit(控制单元): directs and monitors the overall operation of the computer • Keeps track of where the next instruction resides • Issues the signals needed to both read data from and write data to other units in the system • Executes all instructions • Arithmetic and Logic Unit (ALU,运算逻辑单元): performs all of the computations, such as addition, subtraction, comparisons, and so on, that a computer provides • CPUs are constructed as a single microchip, which is referred to as a microprocessor(微处理器)
Control Unit • 控制单元是微处理器最重要的部件之一,因为它负责整个处理过程 • Generates controls used to carry out a program’s instruction. (根据来自译码单元的指令,它会生成控制信号) • 告诉运算逻辑单元(ALU)和寄存器如何运算、对什么进行 运算 • Directs the movement of electronic signals between different parts • Directs control signals between the CPU and input/output devices. • 确保一切事情均发生在正确的时间和正确的地点。
Arithmetic-Logic Unit • Usually called the ALU • performs two types of operations • Arithmetic: addition, subtraction, multiplication, and division • Logical: Comparing two pieces of data to see if one is • equal to (=) the other • less than (<) the other • greater than (>) the other
CPU • 2. 衡量CPU性能的主要技术指标 • CPU字长:内部各寄存器之间一次能够传递的数据位,由内部数据总线决定,反映CPU内部运算速度和效率。 • 位宽:CPU通过外部数据总线与外部设备之间一次能够传递的数据位。 x位CPU:通常用CPU字长和位宽来称呼CPU。 如:Pentium CPU字长是32位,位宽是64位,称为超32位CPU。 80286 CPU字长和位宽都是16位,则称为16位CPU。 • CPU外频 :CPU总线频率,由主板为CPU提供的基准时钟频率。一般等于内存总线频率。 • CPU主频 :CPU内核电路的实际工作频率。 CPU在一个时钟周期里面完成的指令数。主频越高,CPU的速度就越快。由于CPU的内部结构不尽相同,并非时钟频率相同就性能一样。倍频:主频=外频*倍频 • 生产工艺技术:通常用微米(μm)数字来描述,精度越高表示生产工艺越先进,集成度越高。 Socket 478接口LGA775接口
第一台微型计算机: Intel 4004,4位,1969年由Intel公司的M.E.Hoff设计。 微处理器芯片的发展 计算机发展趋势:巨型化、微型化、网络化、智能化和多媒体化。
指令高速缓存 指令高速缓存 (cache): 指令高速缓存是芯片上的指令仓库,这样微处理器就不必停下来查找计算机内存中的指令。这种快速访问方式加快了处理速度,因为预取单元已经“取得”了这些指令,并将其以正确的顺序存放在预取单元中等待处理。
Main Memory Unit(内存) • Stores data and instructions as sequence of bytes • A program must reside in main memory if it is to operate on the computer • Combines 1 or more bytes into a single unit, referred to as a word(字) Address Space for storage Unit 1 Unit 2 Fig. Structure of main memory
Main Memory Unit • RAM , random access memory(随机存储器) • Every section of memory can be accessed randomly as quickly as any other section • Volatile: data is lost when power is turned off • ROM, read only memory(只读存储器) • Nonvolatile • Size is usually specified in bytes (MB or GB) 1 kilobytes (KB) = 1024 bytes 1megabytes (MB) = 1024 KB 1 gigabytes (GB) = 1024 MB 1 terabytes (TB) = 1024 GB
Memory chips - RAM • Random access memory • Chips used for the temporary storage of data and instructions in main memory • Emptied when • The power is turned off • The computer is restarted • Destructive write process • Previous data lost • Nondestructive read process • Data left undisturbed
ROM Memory • Stands for read only memory • Contain special programs for specific computer operations • Programs are built into them at the factory • Data inside could be retrieved, but could not be rewritten • Two variations • PROM (programmable ROM) • Can be written with special equipment once • EPROM (erasable programmable ROM) • Erasable with a special ultraviolet light
Ports Panel • Power plug socket • Keyboard port • Mouse port • Monitor/graphics port • Serial port • Parallel port • USB port • Network port telephone jack • Speaker and microphone jacks
Input and Output -- Two important computing steps
键盘 输入设备 鼠标器 扫描仪 CRT和平板显示器。 SVGA、TVGA。 隔行扫描和逐行扫描。 分辩率:1024 768。 显示器 常用 外部设备 输出设备 绘图仪 喷墨打印机 360~1440DPI 激光打印机 600DPI 打印机 点阵打印机 9针及24针 UPS不间断电源 输入输出设备
Input Devices • Convert people-readable data into machine-readable form • Electronic signals of 0’s and1’s • Most Commonly used • Keyboard • Keys: typewriter keys, function keys, numeric keys, special-purpose and cursor-control keys • Direct entry: data in machine-readable format • Pointing devices, mouse • Scanning devices • Voice-input devices • Digital cameras and Digital video cameras
Pointing devices • Mouse, trackball – cursor moves in response to rolling ball or moving finger • Touch screen – screen recognizes position of touching finger • Light pen - screen recognizes position of light-sensitive penlike device • Digitizer – special pad and stylus used to capture images hand drawn • Pen-base recognizing – handwriting recognition for writing directly on the screen with a stylus
Scanning devices • Convert images of text, drawings or special symbols into machine readable data for computer processing • Types • Image scanner • Fax machines • Fax modem cards • Barcode readers • Others
Voice-input devices • Convert a person’s speech into a digital code • Combined with appropriate software for voice recognition • Some system must be trained to a particular user’s voice • Voice recognition systems • Continuous speech • Discrete word
Digital Cameras • Digital camera • Record still images digitally • CCD: sensor, up to 8 megapixels • Memory: CF, SM, Memory Stick, etc • Vendors: Sony, Nikon, Olympus • Digital video camera • Digital camcorder • Record motion digitally • Also capture still digital images
Output Devices • Pieces of equipment that translate the processed information to a people-readable form • Categories • Monitors • Printers • Plotters • Voice
Monitors • Most common • Pixel: picture element • Matrix of pixels: quality • More pixels, higher resolution • 640x480--1280x1024
Flat-panel monitors • Known as liquid crystal display (LCD) monitors • Portable monitors • Two types
Printers • Convert processed data from machine language to a hard-copy format for human use • Types • Dot-matrix printers • Ink-jet printers • Laser printers • Thermal printers • Other printers
Dot-matrix printer • dots generated by pins that strike an inked ribbon • Inexpensive • Noisy • low image quality
Ink-Jet Printers • Sprays tiny ink droplets at high speed onto paper surface • Letter quality • Full color capable • Reliable • Quiet • inexpensive
Thermal Printers • Use heat elements to produce images on heat sensitive paper • Produce very high quality but are expensive and require special supplies
Secondary Storage(外存) • Used as permanent storage for programs and data • Magnetic tape(磁带), magnetic disks(磁盘), and CD-ROMs • Magnetic tape is often used to backup data separately from the computer. And it is a sequential storage media. • Direct access storage device (DASD): allows a computer to read or write any one file or program independent of its position on the storage medium • Magnetic hard disk(硬盘) consists of rigid platters(硬盘片) that spin together on a common spindle • Initially, the common magnetic disk storage device was the removable floppy disk(软盘) • USB disk can store more data than floppy disk. Its size can be 128M~80GB.
Magnetic Hard Disk 轴 磁道 扇区 盘片 Platters 读/写磁头 柱面