The Nature of Computing

31
The Nature of Computing INEL 4206 – Microprocessors Lecture 2 Bienvenido Vélez Ph. D. School of Engineering University of Puerto Rico - Mayagüez

description

The Nature of Computing. INEL 4206 – Microprocessors Lecture 2 Bienvenido V é lez Ph. D. School of Engineering University of Puerto Rico - Mayag ü ez. Some Inaccurate (Although Popular) Perceptions of Computing. Computing = (Electronic) Computers Computing = Programming - PowerPoint PPT Presentation

Transcript of The Nature of Computing

Page 1: The Nature of Computing

The Nature of ComputingINEL 4206 – Microprocessors

Lecture 2Bienvenido Vélez Ph. D.School of Engineering

University of Puerto Rico - Mayagüez

Page 2: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 2

Some Inaccurate (Although Popular) Perceptions of Computing

• Computing = (Electronic) Computers• Computing = Programming• Computing = Software

Page 3: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 3

Computing = Computers

Computing is about solving problems using computers

A.K.A. The Computing Device View of Computing

Page 4: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 4

Computing = Programming

Computing is about writing programs for computers

A.K.A. The Programming Language view of Computing

Page 5: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 5

Computing = Software

Computing is not concerned withhardware design

A.K.A. The “Floppy Disk” view of Computing

Page 6: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 6

Outline

• What is Computing?• Computing Models and Computability• Interpretation and Universal Computers• Abstraction and Building Blocks

Page 7: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 7

What is computing then?

AlgorithmicComputation

Function

InputInformation

OutputInformation

Computing is the study of Computation:the process of transforming information

Page 8: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 8

The Computation Process

Problem

011011001010100101…

encode

011011001010100101…

compute decode

Solution

Page 9: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 9

Fundamental Questions Addressed by the Discipline of Computing

• What is the nature of computation?• What can be computed?• What can be computed efficiently?• How to build practical computing devices?

Page 10: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 10

Computers as Integer Functions

011011001010100101…

encode

011011001010100101…

compute

Problem

decode

Solution

Integer IntegerIntegerFunction

Page 11: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 11

Computability

All Integer Functions (IF)

ComputableInteger Functions

(CF)

IF ≟ CF

HaltingProblem

IF ≠ CF

Page 12: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 12

The Halting Problem(Alan Turing 1936)

Given a program P and an input I to Pdetermine if P stops on I

ComputerProgram P

Input IP Halts on I?

We cannot build this machine … period

Page 13: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 13

Computability

All Integer Functions (IF)

ComputableInteger Functions

(CF)

IF ≟ CF

HaltingProblem

IF ≠ CF

We want to formallydescribe the set of

computable functions.BUT HOW???

Page 14: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 14

Mathematical Computers:The Turing Machine (1936)

Alan Turing

0 1

0 1FSM

InfiniteI/O

TAPE0/{0,R}

1/{1,L}

TapeHead

Turing demonstrated how to solve several problems using his LCM computing model

Page 15: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 15

Mathematical Computers:The Turing Machine (1936)

Alan Turing Turing demonstrated how to solve several problems using his LCM computing model

0 1

0 1FSM

InfiniteI/O

TAPE0/{0,R}

1/{1,L}

TapeHead

Page 17: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 17

The Halting Problem Proof Sketch (Blackboard)

Given a program P and an input I to Pdetermine if P stops on I

ComputerProgram P

Input IP Halts on I?

Cannot build this … period

Page 18: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 18

FSM

Sorting TMFSM

Sorting TMFSM

Sorting TM

Ad-hoc Turing Machines

FSM

Sorting TMFSM

Searching TMFSM

Integrating TM

Can we build ONE general purpose TM?

We know we can build TM’sto solve many interesting problems.But building a TM is a lot of work

Page 19: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 19

The Universal Turing Machine (UTM)The Paradigm for Modern General Purpose Computers

Universal TM

Encoded TM M Encoded Tape for M

• Capable of Emulating Every other TM • Shown computable by Alan Turing (1936)

Software• just bits• weightless• effective computing models

Hardware• heavy• expensive• cumbersome computing model

BIG IDEAS: INTERPRETATION & PROGRAMMABILITY!!!

Page 20: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 20

Other Familiar Models of Computation

• Combinational Circuits• Sequential Circuits (FSM’s)• Pentium Instruction Set Architecture• Lambda Calculus• Recursive Functions• C, C++, Java, C#, etc…

Can you tell which ones are Turing Universal, or which ones can emulate any other Turing Machine?

Page 21: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 21

Church’s Thesis

Alonso Church

“All the models of computation yet developed, and all those that may be developed in the future, are equivalent in power.”

“Any realizable computing device can be simulated by a Turing machine”

Issues not considered: Size, Programmability, PerformanceBut they must be considered if one is to build …

Page 22: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 22

DataPaths

PCABR

ALU

AC

Practical Universal Computers(John) Von Neumann Architecture (1945)

Program

Data

Memory

Control Unit (FSM)

CPU

CPU is a universal TM An interpreter of some programming language (PL)

status control

This looks just like a TM Tape

Page 23: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 23

Computing in Perspective

CMOSGateFSMISA

Assembler 1 Assembler 2 Assembler 3

C++Pascal Fortran

MatLab

BuildOne

BuildMany

Excel

Programming is the art/science of encoding algorithms

PSpice

All have embedded PL’s

Multiple CoexistingLevels of Interpretation

Page 24: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 24

Computing in Perspective

Application Programs

High-Level Language

AssemblyLanguage

MachineLanguage

(ISA)

CS1/CS2, Programming, Data Structures

Programming Languages, Compilers

Computer Architecture

Computer Human Interaction, User Interfaces

people

People computers

Each abstraction layer implements anINTERPRETER

of some computing/programming model

INEL4206

Page 25: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 25

Why Abstraction Layers?

• Resilience to change:– Each layer provides a level of indirection

• Divide and Conquer Approach:– Can work on one small semantic gap at a time

• Building Block Approach:– Can build many higher layer on same lower layerBecause we know of no

other way of doing anything

Page 26: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 26

Hardware Building Blocks

A B

sel

O

SEL

A

B

O

Gate-Level Logic Provides a Computing Model

A 2-1 multiplexer

Page 27: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 27

Software Building Blocks

// MUX – Implements a 2-1 binary multiplexerbool MUX(bool a, bool b, bool sel) { switch(sel) { case 0: return a; break; case 1: return b; break; }}

Other abstraction tools include: structures, classes, modules

The function is one of the most ubiquitous abstraction tools

Page 28: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 28

What Makes a Good Building Block

• Provides a clear and simple contract• The contract hides irrelevant detail• The contract is general and orthogonal• The contract is easy to remember

Page 29: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 29

Some Properties of a Good Programming Language

• Does not hide expressive power of lower layers• Can be efficiently interpreted• Provides adequate higher level abstractions• Provides a variety of constructs for creating new

abstractions, layers and modules• Achieves all of the above with minimal

complexity

Page 30: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 30

Summary• Computing = Information Transformation• Information Transformation = Integer Functions• Some integer functions are not computable• Turing Machine computations = All computations• Universal Computer = Universal TM• Interpretation => Programmability => Flexibility• Building blocks are abstract contracts

Page 31: The Nature of Computing

The Nature of Computing INEL 4206 - Microprocessors - Spring 2003 31

"Computer Science is no more about computers than Astronomy is about

telescopes" E. W. Dijkstra

1930-20021972 Turing Award

Summary