YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: A little bit of history Jordi Cortadella Department of Computer Science.

A little bit of history

Jordi CortadellaDepartment of Computer Science

Page 2: A little bit of history Jordi Cortadella Department of Computer Science.

Mechanization

Introduction to Programming © Dept. CS, UPC 2

Page 3: A little bit of history Jordi Cortadella Department of Computer Science.

Mechanization

Introduction to Programming © Dept. CS, UPC 3

Page 4: A little bit of history Jordi Cortadella Department of Computer Science.

The old dream of mechanical computing

Introduction to Programming © Dept. CS, UPC 4

Calculating-Table by Gregor Reisch:Margarita Philosophica, 1503.

Roman Abacus

18th-century calculating machine

Page 5: A little bit of history Jordi Cortadella Department of Computer Science.

The first mechanical computer

Introduction to Programming © Dept. CS, UPC 5

• Charles Babbage (1791-1871), English mathematician, philosopher, inventor and mechanical engineer.

• Invented the difference engine (never finished).

• Useful to tabulate polynomial functions.

Page 6: A little bit of history Jordi Cortadella Department of Computer Science.

ENIAC (1946)• The first electronic general-purpose computer,

designed to calculate artillery firing tables.

• 167 m2, 27 tons, it could solve 5000 additions and 385 multiplications in 1 second.

• Programmable withswitches and cables.

• Programming analgorithm could takeseveral weeks.

Introduction to Programming © Dept. CS, UPC 6

Page 7: A little bit of history Jordi Cortadella Department of Computer Science.

Programmable digital computers• Alan Turing (1912-1954), the father of

modern digital computers.

• During 2nd World War, he broke Germanciphers generated by the Enigma machine.The war in Europe was shortened by atleast two years.

• The bombe was the electromechanical machinecreated to break Enigma.

• It could perform chains oflogical deductions for eachsetting of the rotors.

Introduction to Programming © Dept. CS, UPC 7

Page 8: A little bit of history Jordi Cortadella Department of Computer Science.

Introduction to Programming © Dept. CS, UPC 8

Page 9: A little bit of history Jordi Cortadella Department of Computer Science.

Introduction to Programming © Dept. CS, UPC 9

Page 10: A little bit of history Jordi Cortadella Department of Computer Science.

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, UPC 10

1 0 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1• • • • • •

Control

Read/write headInfinite tape

Page 11: A little bit of history Jordi Cortadella Department of Computer Science.

Modern digital computers• John von Neumann (1903-1957).

• Inspired by Turing’s work,he proposed the architecture ofmodern digital computers.

• Essential innovation:programs stored in memory.

• Most computers today arebased on von Neumann’sarchitecture.

Introduction to Programming © Dept. CS, UPC 11

Page 12: A little bit of history Jordi Cortadella Department of Computer Science.

Von Neumann’s architecture

Introduction to Programming © Dept. CS, UPC 12

0110010111001001000011010011110011100011011001010101000111101100011011000100110100100111111011110110010001001100

01110100001011001100010111101101000000000101100100101100100101001110010001110001110011000110100101011101

MemoryLocation 0Location 1Location 2Location 3Location 4

•••

•••

•••

Program

Data

ControlUnitRead

instruction

Program counter

ArithmeticLogic Unit

Read data

Write data

Input

Outputregisters

CPU

Page 13: A little bit of history Jordi Cortadella Department of Computer Science.

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, UPC 13

0: 1:

Page 14: A little bit of history Jordi Cortadella Department of Computer Science.

Representing information with bits1 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 2n states

Introduction to Programming © Dept. CS, UPC 14

R G B Color Name

00000000 11111111 00000000 Green

00000000 00000000 00000000 Black

11111111 11111111 11111111 White

11111111 00000000 11111111 Magenta

01000000 11100000 11010000 Turquoise

01111011 00111111 00000000 Chocolate

Example: RGB model for colors

Any color can be generated by adding the threecomponents with different intensity. 24 bits 16,777,216 colors

Page 15: A little bit of history Jordi Cortadella Department of Computer Science.

Representing information with bits

Introduction to Programming © Dept. CS, UPC 15

Page 16: A little bit of history Jordi Cortadella Department of Computer Science.

Representing numbers with bits

Introduction to Programming © Dept. CS, UPC 16

10011010

Page 17: A little bit of history Jordi Cortadella Department of Computer Science.

Arithmetic operations 10011010 (154)+ 00110011 (51) 11001101 (205)

Introduction to Programming © Dept. CS, UPC 17

01001 (9) x 10011 (19) 01001 01001 00000 00000 01001 010101011 (171)

Conventional computers work with32- or 64-bit representations.

Not all the results can be represented(not enough bits).

Page 18: A little bit of history Jordi Cortadella Department of Computer Science.

Logic circuits and chips

Introduction to Programming © Dept. CS, UPC 18

Page 19: A little bit of history Jordi Cortadella Department of Computer Science.

The evolution of technology

Introduction to Programming © Dept. CS, UPC 19

Intel Ivy Bridge-HE-4 (2013)

160 mm2, 4 cores130 W of power10 billion additions / sec

1.4 billion transistors (22nm)

ENIAC (1946)

167 m2, 270 tons150 kW of power5,000 additions / sec

17,468 vacuum tubes7,200 crystal diodes, 1,500 relays70,000 resistors, 10,000 capacitors

0.8 cm

2 cm

Core 1 Core 2 Core 3 Core 4

Page 20: A little bit of history Jordi Cortadella Department of Computer Science.

The fascinating world of technology

Introduction to Programming © Dept. CS, UPC 20

Page 21: A little bit of history Jordi Cortadella Department of Computer Science.

Back to von Neumann’s architecture

Introduction to Programming © Dept. CS, UPC 21

0110010111001001000011010011110011100011011001010101000111101100011011000100110100100111111011110110010001001100

01110100001011001100010111101101000000000101100100101100100101001110010001110001110011000110100101011101

MemoryLocation 0Location 1Location 2Location 3Location 4

•••

•••

•••

Program

Data

ControlUnitRead

instruction

Program counter

ArithmeticLogic Unit

Read data

Write data

Input

Outputregisters

Page 22: A little bit of history Jordi Cortadella Department of Computer Science.

Machine codeMIPS 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, UPC 22

Page 23: A little bit of history Jordi Cortadella Department of Computer Science.

Assembly language

fact:bne $a0, $zero, genori $v0, $zero, 1jr $ra

gen:addiu $sp, $sp, -8sw $ra, 4($sp)sw $a0, 0($sp)addiu $a0, $a0, -1jal factlw $a0, 0($sp)lw $ra, 4($sp)addiu $sp, $sp, 8mul $v0, $v0, $a0jr $ra

Introduction to Programming © Dept. CS, UPC 23

operation operands

MIPS assembly language

Every line corresponds toan instruction of machine code

Function that calculatesthe factorial of a number (n!)

addiu $a0 $a0 -1

00100100100001001111111111111111

Page 24: A little bit of history Jordi Cortadella Department of Computer Science.

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, UPC 24

C AREA OF A TRIANGLE - HERON'S FORMULAC INPUT - CARD READER UNIT 5, INTEGER INPUTC OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUTC 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

Page 25: A little bit of history Jordi Cortadella Department of Computer Science.

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, UPC 25

Page 26: A little bit of history Jordi Cortadella Department of Computer Science.

High-level programming languages

Introduction to Programming © Dept. CS, UPC 26

Function to calculate n!:

factorial n = if n == 0 then 1 else nfactorial(n - 1)

Haskell

int factorial(int n) { if (n == 0) return 1; return nfactorial(n - 1);}

C++

def factorial(n): if n == 0: return 1 else: return nfactorial(n - 1)

Python

MIPS assembly language

fact:bne $a0, $zero,

genori $v0, $zero, 1jr $ra

gen:addiu $sp, $sp, -8sw $ra, 4($sp)sw $a0, 0($sp)addiu $a0, $a0, -1jal factlw $a0, 0($sp)lw $ra, 4($sp)addiu $sp, $sp, 8mul $v0, $v0, $a0jr $ra

Page 27: A little bit of history Jordi Cortadella Department of Computer Science.

Compilers

Introduction to Programming © Dept. CS, UPC 27

int factorial(int n) { if (n == 0) return 1; return nfactorial(n - 1);}

001100101111001010001011000101101101010100011100101001010010100110010101001000101110101010101001101001010100010101010101101010000010101000100101110100011000100110010100101000100101011101101010 . . .

Compilers translate programswritten in high-level languagesinto machine codeCompiler

Page 28: A little bit of history Jordi Cortadella Department of Computer Science.

Introduction to Programming © Dept. CS, UPC 28

The trip tocomputer programming

starts now:You define your limits.

Page 29: A little bit of history Jordi Cortadella Department of Computer Science.

Our challenge in this course

Design a program that solvesa difficult Sudoku in one second!

Introduction to Programming © Dept. CS, UPC 29

Page 30: A little bit of history Jordi Cortadella Department of Computer Science.

Introduction to Programming © Dept. CS, UPC 30

Let’s make ithappen together !


Related Documents