Datorteknik och datornät [Computer Hardware, Architecture and Network] www.ida.liu.se/~hiic6 Zebo Peng Institutionen för datavetenskap (IDA) Linköpings universitet Objectives How does a computer work and communicate? 0 Hardware 0 Operating system 0 Computer network Terminology and basic concepts of computer systems and networks. 1
Datorhårdvara och maskininstruktion Kursinnehåll I 0 Centralenheten och instruktionsutförande. 0 t och sekundärminnen. 0 Maskinnära språk och assemblyspråk. 0 Datorarkitektur. Operativsystem 0 Grundläggande principer för operativsystem. 0 Minneshantering. 0 Multiusersystem, time-sharing. 3 Kursinnehåll II Datornät (Johan Fagerström) 0 Introduktion till datakommunikation. 0 Grundläggande principer för datornät. 0 Protokoll: TCP/IP och OSI-modellen. 0 Internet. 4
Huvudlitteratur Kursmaterial Datorteknikdelen 0 William Stallings: Computer Organization and Architecture: Designing for Performance, 6th edition, Prentice-Hall. Datornätdelen 0 James F. Kurose and Keith W. Ross: Computer Networking: A Top-Down Approach Featuring the Internet, 3rd edition, Pearson Education. Föreläsningsantekningar. 5 Ytterligare material Kursmaterial (Cont d) 0 Läsanvisningar (repetitionsfrågor). Referenslitteratur för kursen 0 S. Nachmens: Datasystem och datorsystem, Studentlitteratur, ISBN 91-44-13153-4. 0 Gunvald Hedemalm: Nätverk från grunden, 3:e upplagan, Pagina, ISBN 91-636-0506-6. 0 V. C. Hamacher, et al.: Computers Organization, McGraw-Hill, ISBN 0-07-11433-8. 6 3
Föreläsning I Dator och datorsystem Processenheten Maskininstruktion och maskininstruktionsutförande Technologitrender Sammanfattning 7 What is a computer? 8 4
Definition of a Computer A computer is a data processing machine which is operated automatically under the control of a list of instructions (called a program) stored in its main memory. Dator dataöverföring komandon 9 A Computer System A computer system consists of a computer and its peripherals [periferenheter]. Computer peripherals include input devices [inenheter], output devices [utenheter], and secondary memories [sekundärminnen]. Datorsystem Inenhet Dator Utenhet Processenhet Sekundärminne 10 5
Basic Principles of Computers Virtually all modern computer designs are based on the von Neumann architecture principles: Data and instructions are stored in a single read/write memory. The contents of this memory are addressable by location, without regard to what are stored there. Execution occurs in a sequential fashion (unless explicitly modified) from one instruction to the next. Memory 11 Why von Neumann architecture? General-purpose, programmable. Instructions can be treated as data. Instruction execution is done automatically. It can be built with very simple electronics components: 0 Data processing function is performed by gates. 0 Data storage function is provided by memory cells. 0 Data communication is achieved by wires. Memory 1 6
1 st Generation of Computers Built with Vacuum tube [vakuumrör]. 1946-1957 Speed: ~40,000 operations per second Eniac, 1946 13 nd Generation of Computers Built with transistors. 1958-1964. Speed: ~00,000 operations per second The 1 st transistor (Bell Labs, 1947) 14 7
3 rd Generation of Computers Built with integrated circuits [integrerad krets]. 1965-1971. 0 Small scale integration - 1965 on; Up to 100 devices on a chip 0 Medium scale integration - to 1971; 100-3,000 devices on a chip Speed: ~1,000,000 operations per second. Chip 15 4 th Generation of Computers Built with large-scale integrated (LSI) circuits. 197-1977. 3,000-100,000 devices on a chip. Speed: ~10,000,000 operations per second. LSI 16 8
5 th Generation of Computers Built with very-large-scale integrated (VLSI) circuits. 1978-. 100,000-100,000,000 devices on a chip Speed: ~100,000,000 operations per second. Ultra-large-scale integration = Over 100,000,000 devices on a chip. Source: S3 17 Moore s s Law # of trans. 100M 75M 50M Number of transistors per chip would double every 1.5 years Clock Frequency (every years) Performance Software size Memory capacity 5M 75 80 85 90 95 18 00 year 9
Intel Microprocessor Evolution 19 [ [Processenhet] The Central Processing Unit (), also called processor, includes two main units: a program control unit, and an Arithmetic and Logic Unit (ALU). Processenhet Aritmetisk och logisk enhet Register Klocka 0 10
(Cont d) The primary function of a is to execute the instructions stored in the main memory. An instruction tells the to perform one of its basic operations. The includes also a set of registers, which are temporary storage devices used to hold control information, key data, and intermediate results. The operations of the components of a computer are synchronized by a clock unit which generates regular pulses of electronics signals. Within a clock cycle time, one or several operations is performed. (Ex. clock frequency of a Pentium 3 733 MHz.) 1 Some Measurement Terms 1 K = 104 = 10 10 3 (kilo) 1 M = 10 6 0 (mega) 1 G = 10 9 30 (giga) 1 m = 10-3 (milli) 1 µ = 10-6 (mikro) 1 n = 10-9 (nano) 1 mån.6 X10 6 sekund 3 år 1 X10 9 sekund Speed of light 0.3 X10 9 meters/second 11
Representation of Data Inside a computer, data and control information are all represented in binary format which uses only two basic symbols, 0 and 1. The two basic symbols are usually represented by electronics signals. Data are represented as a sequence of bits such as 10100001. Different coding systems have been used. One commonly used system is ASCII. 3 Representation of Numeric Data The binary system [binära talsystemet] uses the same positional scheme as the decimal system. The positional values are factors of : i.e., 1,, 4, 8, 16,... instead of 10. Binary numbers are added, subtracted, multiplied, and divided directly (no need to convert them to decimal number first). 4 1
The Machine Instructions The can only execute machine code [maskinkod] in binary format, called machine instruction [maskininstruktion]. A machine instruction specifies the following information: 0 Operation code [operationskod]; 0 Operands [operand] Where: in memory, registers, or instruction; Addressing mode; 0 Address of the next instruction. The operation code specifies the type of the instructions: 0 data manipulation (arithmetic, logic, etc.) 0 data moving operations (load, I/O, etc.) 0 control operations (conditional branches, etc.) 5 Ex. of an Instruction Set OP 000 Betydelse Läs Instruktions -förkortning LOAD A Verkan m(a) -> AR Tid (µs) 001 Skriv STORE A ar -> m(a) 010 Addera ADD A ar+m(a) -> ar 011 Subtrahera SUB A ar-m(a) -> ar 100 Hopp JUMP A A -> IAR (PC) 1 101 110 Hopp på plus In PJUMP A IN A -> IAR om ar>=0, annars iar+1->iar In -> AR 1 1 111 Ut UT ar -> UT 1 6 13
Instruction Execution IAR (PC) AR IR Aritmetisk och logisk enhet MAR MBR Adress Data 7 fetch cycle [hämtfas] Instruction Execution execute cycle [exekveringsfas] fetch decode execute PC -> MAR Decode(IR) M[MAR] -> MBR MAR -> IR PC + 1 -> PC Perform the specified operation (memory access may be needed) (PC may be changed) [hämta] [avkoda] [exekvera] IAR (PC) AR MAR IR MBR Aritmetisk och logisk enhet 8 14
Ex på instruktionsutförande rande IAR (PC) AR IR Aritmetisk och logisk enhet MAR MBR Adress Data 9 Ex på instruktionsutförande rande Adress Data 1013 1014 1015 1016 1017 LOAD 3715 ADD 3716 SUB 3717 STORE 3715 JUMP 01 A := A + B C; goto S1 01 XXX XXXX S1 3715 3716 3718 10 0 15 A B C 30 15
Ex på instruktionsutförande rande 0 1013 IAR (PC) AR 1 1013 MAR IR TR Aritmetisk och logisk enhet Adress Data 31 Ex på instruktionsutförande rande 1013 LOAD 3715 Adress Data 1013 1014 1015 1016 1017 LOAD 3715 ADD 3716 SUB 3717 STORE 3715 JUMP 01 A := A + B C; goto S1 01 XXX XXXX S1 3715 3716 3718 10 0 15 A B C 3 16
The fetch cycle: Ex på instruktionsutförande rande 1013 1014 04 IAR (PC) AR 1 1013 MAR LOAD 3715 3 IR MBR Aritmetisk och logisk enhet LOAD 3715 Adress LOAD 3715 Data 33 The fetch cycle: Ex på instruktionsutförande rande 1013 1014 IAR (PC) AR Decoding 5 LOAD 3715 Aritmetisk och logisk enhet 1013 MAR MBR LOAD 3715 IR Adress Data 34 17
The execution cycle: Ex på instruktionsutförande rande 1013 1014 IAR (PC) AR 1 LOAD 3715 Aritmetisk och logisk enhet 3715 MAR MBR LOAD 3715 IR Adress Data 35 Ex på instruktionsutförande rande 3715 10 Adress Data 1013 1014 1015 1016 1017 LOAD 3715 ADD 3716 SUB 3717 STORE 3715 JUMP 01 A := A + B C; goto S1 01 XXX XXXX S1 3715 3716 3718 10 0 15 A B C 36 18
The execution cycle: Ex på instruktionsutförande rande 1013 1014 IAR (PC) AR 3 10 1 LOAD 3715 Aritmetisk och logisk enhet 3715 MAR MBR 10 IR Adress Data 37 Machine Cycles The execution of an instruction is carried out in a machine cycle (instruction cycle). The executes one instruction after the other, cycle by cycle, repeatedly. The machine cycle time (or instruction execution time) of a computer gives an indication of its performance (speed). Ex. a computer can have a performance of 733 MIPS (Millions of Instructions Per Second). Since different instructions need different time to execute, the average instruction execution time [medelinstruktionstid] is used to calculate performance. 38 19
Summary A computer executes repeatedly a series of instructions (called programs) stored in its main memory: 0 It performs data processing operations specified by the programs. 0 It runs the programs automatically, with no need for human intervention. 0 It can perform the operations in extremely high speed. 0 It can store and manipulate a large amount of data. 0 It can communicate with each other and with users in an efficient way. 0 It represents program and data in the same way, which leads to flexibility. 39 0