Presentation is loading. Please wait.

Presentation is loading. Please wait.

A little bit of history Jordi Cortadella Department of Computer Science.

Similar presentations


Presentation on theme: "A little bit of history Jordi Cortadella Department of Computer Science."— Presentation transcript:

1 A little bit of history Jordi Cortadella Department of Computer Science

2 Mechanization Introduction to Programming© Dept. CS, UPC2

3 Mechanization Introduction to Programming© Dept. CS, UPC3

4 The old dream of mechanical computing Introduction to Programming© Dept. CS, UPC4 Calculating-Table by Gregor Reisch: Margarita Philosophica, 1503. Roman Abacus 18 th -century calculating machine

5 The first mechanical computer Introduction to Programming© Dept. CS, UPC5 Charles Babbage (1791-1871), English mathematician, philosopher, inventor and mechanical engineer. Invented the difference engine (never finished). Useful to tabulate polynomial functions.

6 ENIAC (1946) The first electronic general-purpose computer, designed to calculate artillery firing tables. 167 m 2, 27 tons, it could solve 5000 additions and 385 multiplications in 1 second. Programmable with switches and cables. Programming an algorithm could take several weeks. Introduction to Programming© Dept. CS, UPC6

7 Programmable digital computers Alan Turing (1912-1954), the father of modern digital computers. During 2 nd World War, he broke German ciphers generated by the Enigma machine. The war in Europe was shortened by at least two years. The bombe was the electromechanical machine created to break Enigma. It could perform chains of logical deductions for each setting of the rotors. Introduction to Programming© Dept. CS, UPC7

8 Introduction to Programming© Dept. CS, UPC8

9 Introduction to Programming© Dept. CS, UPC9

10 Turing machine A universal machine: theoretical model for computability. It can simulate any computer algorithm. Useful to understand the limits of mechanical computations. Turing machines were the inspiration for modern CPUs. Introduction to Programming© Dept. CS, UPC10 10011101011010001001101011 Control Read/write head Infinite tape

11 Modern digital computers John von Neumann (1903-1957). Inspired by Turing’s work, he proposed the architecture of modern digital computers. Essential innovation: programs stored in memory. Most computers today are based on von Neumann’s architecture. Introduction to Programming© Dept. CS, UPC11

12 Von Neumann’s architecture Introduction to Programming© Dept. CS, UPC12 01100101 11001001 00001101 00111100 11100011 01100101 01010001 11101100 01101100 01001101 00100111 11101111 01100100 01001100 01110100 00101100 11000101 11101101 00000000 01011001 00101100 10010100 11100100 01110001 11001100 01101001 01011101 Memory Location 0 Location 1 Location 2 Location 3 Location 4 Program Data Control Unit Read instruction Program counter Arithmetic Logic Unit Read data Write data Input Output registers CPU

13 Why digital? Binary digit (bit): minimum unit of information – yes/no, on/off, true/false, am/pm, open/close, … Binary representations are very convenient for physical (electrical) implementations. Electronic computers use voltage levels to represent bits, e.g., 0 (0 volts) and 1 (3.3 volts) Introduction to Programming© Dept. CS, UPC13 0: 1:

14 Representing information with bits 1 bit  2 states (0, 1) 2 bits  4 states (00, 01, 10, 11) 3 bits  8 states (000, 001, 010, 011, 100, 101, 110, 111) n bits  2 n states Introduction to Programming© Dept. CS, UPC14 RGBColorName 000000001111111100000000Green 00000000 Black 11111111 White 111111110000000011111111Magenta 010000001110000011010000Turquoise 011110110011111100000000Chocolate Example: RGB model for colors Any color can be generated by adding the three components with different intensity. 24 bits  16,777,216 colors

15 Representing information with bits Introduction to Programming© Dept. CS, UPC15

16 Representing numbers with bits Introduction to Programming© Dept. CS, UPC16 10011010

17 Arithmetic operations 10011010 (154) + 00110011 (51) 11001101 (205) Introduction to Programming© Dept. CS, UPC17 01001 (9) x 10011 (19) 01001 00000 01001 010101011 (171) Conventional computers work with 32- or 64-bit representations. Not all the results can be represented (not enough bits).

18 Logic circuits and chips Introduction to Programming© Dept. CS, UPC18

19 The evolution of technology Introduction to Programming© Dept. CS, UPC19 Intel Ivy Bridge-HE-4 (2013) 160 mm 2, 4 cores 130 W of power 10 billion additions / sec 1.4 billion transistors (22nm) ENIAC (1946) 167 m 2, 270 tons 150 kW of power 5,000 additions / sec 17,468 vacuum tubes 7,200 crystal diodes, 1,500 relays 70,000 resistors, 10,000 capacitors 0.8 cm 2 cm Core 1Core 2Core 3Core 4

20 The fascinating world of technology Introduction to Programming© Dept. CS, UPC20

21 Back to von Neumann’s architecture Introduction to Programming© Dept. CS, UPC21 01100101 11001001 00001101 00111100 11100011 01100101 01010001 11101100 01101100 01001101 00100111 11101111 01100100 01001100 01110100 00101100 11000101 11101101 00000000 01011001 00101100 10010100 11100100 01110001 11001100 01101001 01011101 Memory Location 0 Location 1 Location 2 Location 3 Location 4 Program Data Control Unit Read instruction Program counter Arithmetic Logic Unit Read data Write data Input Output registers

22 Machine code MIPS architecture (32 bits): 000000 00001 00010 00110 00000 100000 arith R1 R2 R6 add R6  R1 + R2 100011 00011 01000 00000 00001 000100 load R3 R8 68 R8  Memory [R3 + 68] 000010 00000 00000 00000 10000 000000 jump 1024 PC  PC + 1024 Introduction to Programming© Dept. CS, UPC22

23 Assembly language fact: bne$a0, $zero, gen ori $v0, $zero, 1 jr $ra gen: addiu $sp, $sp, -8 sw $ra, 4($sp) sw $a0, 0($sp) addiu $a0, $a0, -1 jal fact lw $a0, 0($sp) lw $ra, 4($sp) addiu $sp, $sp, 8 mul$v0, $v0, $a0 jr$ra Introduction to Programming© Dept. CS, UPC23 operation operands MIPS assembly language Every line corresponds to an instruction of machine code Function that calculates the factorial of a number (n!) addiu $a0 $a0 -1 00100100100001001111111111111111

24 High-level programming languages Programming in assembly language is a tedious and unpleasant task. Every computer has a different assembly language  incompatibility of codes. High-level languages: – Independent from the computer – Higher levels of abstraction – Closer to natural language (if-then, while-do, …) The first high-level language with broad adoption was FORTRAN, developed by IBM in the 1950s for scientific and engineering applications. Today, there are thousands of programming languages: – FORTRAN, Cobol, Java, C++, Python, Go, Haskell, Perl, Excel, Pascal, Javascript, PHP, C#, R, Matlab, SQL, … Introduction to Programming© Dept. CS, UPC24 C AREA OF A TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING INTEGER A,B,C READ(5,501) A,B,C 501 FORMAT(3I5) IF(A.EQ.0.OR. B.EQ.0.OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C)) WRITE(6,601) A,B,C,AREA 601 FORMAT(4H A=,I5,5H B=,I5,5H C=,I5,8H AREA=,F10.2,12HSQUARE UNITS) STOP END C AREA OF A TRIANGLE - HERON'S FORMULA C INPUT - CARD READER UNIT 5, INTEGER INPUT C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING INTEGER A,B,C READ(5,501) A,B,C 501 FORMAT(3I5) IF(A.EQ.0.OR. B.EQ.0.OR. C.EQ.0) STOP 1 S = (A + B + C) / 2.0 AREA = SQRT( S * (S - A) * (S - B) * (S - C)) WRITE(6,601) A,B,C,AREA 601 FORMAT(4H A=,I5,5H B=,I5,5H C=,I5,8H AREA=,F10.2,12HSQUARE UNITS) STOP END

25 High-level programming languages Programming in assembly language is a tedious and unpleasant task. High-level languages: – Independent from the computer – Higher levels of abstraction – Closer to natural language (if-then, while-do, …) The first high-level language: FORTRAN (IBM, 1957). Today, there are thousands of programming languages: – Basic, Cobol, Java, C++, Go, Python, Ruby, Lisp, Haskell, ML, Prolog, Perl, Excel, Pascal, Javascript, PHP, C#, R, Matlab, SQL, Smalltalk, Eiffel, Scratch, … Introduction to Programming© Dept. CS, UPC25

26 High-level programming languages Introduction to Programming© Dept. CS, UPC26 Function to calculate n!: factorial n = if n == 0 then 1 else nfactorial(n - 1) Haskell int factorial(int n) { if (n == 0) return 1; return nfactorial(n - 1); } C++ def factorial(n): if n == 0: return 1 else: return nfactorial(n - 1) Python MIPS assembly language fact: bne$a0, $zero, gen ori $v0, $zero, 1 jr $ra gen: addiu $sp, $sp, -8 sw $ra, 4($sp) sw $a0, 0($sp) addiu $a0, $a0, -1 jal fact lw $a0, 0($sp) lw $ra, 4($sp) addiu $sp, $sp, 8 mul$v0, $v0, $a0 jr$ra

27 Compilers Introduction to Programming© Dept. CS, UPC27 int factorial(int n) { if (n == 0) return 1; return nfactorial(n - 1); } 00110010111100101000101100010110 11010101000111001010010100101001 10010101001000101110101010101001 10100101010001010101010110101000 00101010001001011101000110001001 10010100101000100101011101101010... Compilers translate programs written in high-level languages into machine code CompilerCompiler

28 Introduction to Programming© Dept. CS, UPC28

29 Our challenge in this course Design a program that solves a difficult Sudoku in one second! Introduction to Programming© Dept. CS, UPC29

30 Introduction to Programming© Dept. CS, UPC30


Download ppt "A little bit of history Jordi Cortadella Department of Computer Science."

Similar presentations


Ads by Google