Transcript
Page 1: Lec02-CS110 Computational Engineering

CS110: Models of Computing

Lecture 2V. Kamakoti

3rd January 2008

Page 2: Lec02-CS110 Computational Engineering

• What IS a computer?• A computer is a machine• Something that operates mechanically• But it is a flexible machine• Its behaviour is controlled by a program• A program is like a spell cast on a machine• Programmers are like wizards• Programs reside in the memory of the

machine– Charles Babbage (1791-1871)– “The stored program concept”

Page 3: Lec02-CS110 Computational Engineering

Early Computing Hardware

The Slide rule The Chinese Abacus

The gear replaced the beads inearly mechanical calculators

“History of computing hardware”From Wikipedia, the free encyclopedia

Page 4: Lec02-CS110 Computational Engineering

Jaquard looms

Used punched cards to weave different patterns

Page 5: Lec02-CS110 Computational Engineering

The DifferenceEngine

The London Science Museum'sreplica Difference Engine, builtfrom Babbage's design.

Part of Babbage's differenceengine, assembled after hisdeath by Babbage's son, usingparts found in his laboratory.

Page 6: Lec02-CS110 Computational Engineering

The First ProgrammerAugusta Ada King, Countess ofLovelace (December 10, 1815 –November 27, 1852), born AugustaAda Byron, is mainly known forhaving written a description ofCharles Babbage's early mechanicalgeneral-purpose computer, theanalytical engine.

The programming language ADA is named after her.

Page 7: Lec02-CS110 Computational Engineering

ENIAC – the first electronic computerPhysically, ENIAC wasmassive compared to modernPC standards. It contained17,468 vacuum tubes, 7,200crystal diodes, 1,500 relays,70,000 resistors, 10,000capacitors and around 5million hand-soldered joints.It weighed 30 short tons (27 t),was roughly 8 feet (2.4 m) by3 feet (0.9 m) by 100 feet (30m), took up 1800 square feet(167 m²), and consumed 150kW of power.

Page 8: Lec02-CS110 Computational Engineering

2000: Intel Pentium 4 ProcessorClock speed: 1.5 GHz# Transistors: 42 millionTechnology: 0.18µm CMOS

Page 9: Lec02-CS110 Computational Engineering

High Level Prog.

Assembly Language

Operating Systems

Digital Hardware

Structured

Computer

Organization

Page 10: Lec02-CS110 Computational Engineering

A typical PC Specification fromtoday’s Newspaper

• Intel Core 2 Duo 6550 2.33GHz• 2x2MB L2 Cache/ 1333MHz FSB• Intel DG31PR Motherboard• 2GB DDR2 RAM 667MHz• 160GB SATA 3Gbps HDD• Onboard Intel Graphics Controller• Onboard 10/100Mbps Ethernet• Onboard Sound card• 19” Widescreen TFT Monitor (Viewsonic)• Logitech Keyboard and Optical Mouse• DVD Writer• Creative 2.0 Speakers• 500VA UPS

Page 11: Lec02-CS110 Computational Engineering

The computing machinePROCESSOR

The computer is made up of a processor and a memory. The memorycan be thought of as a series of locations to store information.

MEMORY

01234……. (say) 256 MEGABYTES

Page 12: Lec02-CS110 Computational Engineering

The computing machinePROCESSOR

The processor treats part of the information in memory as instructions,and a part of it as data. A program is a sequence of instructionsassembled for some given task. Most instructions operate on data. Someinstructions control the flow of the operations. It is even possible to treatprograms as data. By doing so a program could even modify itself.

MEMORY

01234……. 256 MEGABYTES

program data

Page 13: Lec02-CS110 Computational Engineering

Variables

• Each memory location is given a name.• The name is the variable that refers to the

data stored in that location.• Variables have types that define the

interpretation data.– e.g. integers (1, 14, 25649), or characters (a, f, G,

H)• All data is represented as binary strings. That

is, it is a sequence of 0’s and 1’s, of apredetermined size – “word”. A byte is madeof 8 bits.

Page 14: Lec02-CS110 Computational Engineering

Instructions

• Instructions take data stored in variables asarguments.

• Some instructions do some operation on thedata and store it back in some variable.

• The instruction “XX+1” on integer type saysthat “Take the integer stored in X, add 1 to it,and store it back in (location) X”..

• Other instructions tell the processor to dosomething. For example, “jump” to a particularinstruction next, or to exit

Page 15: Lec02-CS110 Computational Engineering

Programs• A program is a sequence of instructions.• Normally the processor works as follows,

– Step A: pick next instruction in the sequence -Program Counter

– Step B: Decode the instruction– Step C: get data for the instruction to operate upon– Step D: execute instruction on data (or “jump”)– Step E: store results in designated location

(variable)• Different parts of the processor are

responsible for the above steps.

Page 16: Lec02-CS110 Computational Engineering

Test Your Understanding -Please copy in your notebook

• Name at least 20 important electroniccircuitry/peripherals inside/connected toa PC.

• What are the four prominent levels in aStructured Computer Organization?

• What are the five steps taken by theprocessor to execute an instruction?

Page 17: Lec02-CS110 Computational Engineering

Test Your Understanding -Please copy in your notebook

• Suppose each stage takes onemillisecond, then each instruction takesfive milliseconds to complete execution.

• Then 10000 instructions shall take50000 milliseconds.

• Is there a way to improve this?

Page 18: Lec02-CS110 Computational Engineering

Answers

Page 19: Lec02-CS110 Computational Engineering

20 components

1) Motherboard2) Processor Chip3) Cache4) Bus5) Memory6) Printer7) USB pen drive8) External Disk

Page 20: Lec02-CS110 Computational Engineering

20 components

9) CD/DVD Drive10) Monitor11) Webcam12) Keyboard13) Mouse14) Graphics Card15) Speaker16) Mic

Page 21: Lec02-CS110 Computational Engineering

20 components

17) Network Card - Wired18) Wireless Network card19) Power Supply20) Floppy drive

Four levels: High level, Assembler lang. level,Operating Systems and Digital Hardware

Page 22: Lec02-CS110 Computational Engineering

Making it fast

Fetch + Inc. PC

Decode Instrn

Fetch Data

Execute Instrn

Store Data

10000 Instructions

No pipelining takes

50000 Units. Eachhardware isindependent.

With Pipelining

I1I2

I1

I3

I2

I1

I4

I3

I2

I1

I5

I4

I3

I2

I1

First Instructioncompletes at end of5th unit

Second instructionat end of 6th unit

10000th instructionat end of 10004units

Page 23: Lec02-CS110 Computational Engineering

The concept• Instruction Level Parallelism• You can use more than one CPU - Multicore

Page 24: Lec02-CS110 Computational Engineering

Creative Problem - 1• The Towers of Hanoi: Move from peg 1 to

peg 3, such that a larger disk is not on top ofa small one.

Src: wikipedia

Page 25: Lec02-CS110 Computational Engineering

One disk - one move

Page 26: Lec02-CS110 Computational Engineering

One disk - one move

Page 27: Lec02-CS110 Computational Engineering

Two disks - three moves

Page 28: Lec02-CS110 Computational Engineering

Two disks - Move 1

Page 29: Lec02-CS110 Computational Engineering

Two disks - Move 2

Page 30: Lec02-CS110 Computational Engineering

Two disks - Move 3

Page 31: Lec02-CS110 Computational Engineering

Three disks - 7 moves

Page 32: Lec02-CS110 Computational Engineering

Three disks - move 1

Page 33: Lec02-CS110 Computational Engineering

Three disks - move 2

Page 34: Lec02-CS110 Computational Engineering

Three disks - move 3

Page 35: Lec02-CS110 Computational Engineering

Three disks - move 4

Page 36: Lec02-CS110 Computational Engineering

Three disks - move 5

Page 37: Lec02-CS110 Computational Engineering

Three disks - move 6

Page 38: Lec02-CS110 Computational Engineering

Three disks - move 7

Page 39: Lec02-CS110 Computational Engineering

The problem

How many? Proveit.

n

73

32

11No. of MovesNo. of Disks

Page 40: Lec02-CS110 Computational Engineering

Thank You

• Monday– Lab starts on Monday

• RF-ID 1 to 60 - Monday batch• RF-ID 61 to 120 - Tuesday• RF-ID 121 to 180 - Wed• RF-ID 181 to 240 - Thurs• RF-ID 241 to 300 - Fri

– Lab details + solution to Towers of Hanoi


Top Related