Published on March 3, 2014
CS110: Models of Computing Lecture 2 V. Kamakoti 3rd January 2008
• • • • • • • • 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”
Early Computing Hardware The Slide rule The gear replaced the beads in early mechanical calculators “History of computing hardware” From Wikipedia, the free encyclopedia The Chinese Abacus
Jaquard looms Used punched cards to weave different patterns
The Difference Engine Part of Babbage's difference engine, assembled after his death by Babbage's son, using parts found in his laboratory. The London Science Museum's replica Difference Engine, built from Babbage's design.
The First Programmer Augusta Ada King, Countess of Lovelace (December 10, 1815 – November 27, 1852), born Augusta Ada Byron, is mainly known for having written a description of Charles Babbage's early mechanical general-purpose computer, the analytical engine. The programming language ADA is named after her.
ENIAC – the first electronic computer Physically, ENIAC was massive compared to modern PC standards. It contained 17,468 vacuum tubes, 7,200 crystal diodes, 1,500 relays, 70,000 resistors, 10,000 capacitors and around 5 million hand-soldered joints. It weighed 30 short tons (27 t), was roughly 8 feet (2.4 m) by 3 feet (0.9 m) by 100 feet (30 m), took up 1800 square feet (167 m²), and consumed 150 kW of power.
2000: Intel Pentium 4 Processor Clock speed: 1.5 GHz # Transistors: 42 million Technology: 0.18µm CMOS
High Level Prog. Assembly Language Structured Computer Operating Systems Digital Hardware Organization
A typical PC Specification from today’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
The computing machine PROCESSOR MEMORY 01234……. (say) 256 MEGABYTES The computer is made up of a processor and a memory. The memory can be thought of as a series of locations to store information.
The computing machine PROCESSOR MEMORY 01234……. program 256 MEGABYTES data The processor treats part of the information in memory as instructions, and a part of it as data. A program is a sequence of instructions assembled for some given task. Most instructions operate on data. Some instructions control the flow of the operations. It is even possible to treat programs as data. By doing so a program could even modify itself.
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 a predetermined size – “word”. A byte is made of 8 bits.
Instructions • Instructions take data stored in variables as arguments. • Some instructions do some operation on the data and store it back in some variable. • The instruction “XX+1” on integer type says that “Take the integer stored in X, add 1 to it, and store it back in (location) X”.. • Other instructions tell the processor to do something. For example, “jump” to a particular instruction next, or to exit
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.
Test Your Understanding Please copy in your notebook • Name at least 20 important electronic circuitry/peripherals inside/connected to a PC. • What are the four prominent levels in a Structured Computer Organization? • What are the five steps taken by the processor to execute an instruction?
Test Your Understanding Please copy in your notebook • Suppose each stage takes one millisecond, then each instruction takes five milliseconds to complete execution. • Then 10000 instructions shall take 50000 milliseconds. • Is there a way to improve this?
20 components 1) 2) 3) 4) 5) 6) 7) 8) Motherboard Processor Chip Cache Bus Memory Printer USB pen drive External Disk
20 components 9) CD/DVD Drive 10) Monitor 11) Webcam 12) Keyboard 13) Mouse 14) Graphics Card 15) Speaker 16) Mic
20 components 17) Network Card - Wired 18) Wireless Network card 19) Power Supply 20) Floppy drive Four levels: High level, Assembler lang. level, Operating Systems and Digital Hardware
Making it fast Fetch + Inc. PC I5 I4 I3 I2 I1 I4 I3 I2 I1 Decode Instrn Fetch Data Execute Instrn Store Data I3 I2 I1 I2 I1 I1 First Instruction completes at end of 5th unit With Pipelining Second instruction 10000 Instructions th unit at end of 6 No pipelining takes 10000th instruction 50000 Units. Each at end of 10004 hardware is units independent.
The concept • Instruction Level Parallelism • You can use more than one CPU - Multicore
Creative Problem - 1 • The Towers of Hanoi: Move from peg 1 to peg 3, such that a larger disk is not on top of a small one. Src: wikipedia
One disk - one move
One disk - one move
Two disks - three moves
Two disks - Move 1
Two disks - Move 2
Two disks - Move 3
Three disks - 7 moves
Three disks - move 1
Three disks - move 2
Three disks - move 3
Three disks - move 4
Three disks - move 5
Three disks - move 6
Three disks - move 7
The problem No. of Disks 1 No. of Moves 1 2 3 3 7 n How many? Prove it.
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
5. The Difference Engine Part of Babbage's difference engine, assembled after his death by Babbage's son, using parts found in his laboratory.The London ...
1. CS110: Arrays in C Lecture 12 V. Kamakoti 4th February 2008. 2. Loops • for (j = 1; j <= 10; j++) – The initial and final conditions are known.
Lec15-CS110 Computational Engineering; Lec15-CS110 Computational Engineering Nov 10, 2014 Education ... Lec02-CS110 Computational Engineering. Login or Join.
View 5529 Computational Engineering posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn.
CS-110 Computational Engineering Part 3. A. Avudainayagam Department of Mathematics. Root Finding: f(x)=0. Method 1: The Bisection method Th: If f(x) is ...
1. Engineering computational ecosystemsIng. Dott. Danilo Pianinidanilo.firstname.lastname@example.org Alma Mater Studiorum—Universit` di Bologna a Cesena aVieni via ...