Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programming Methodology Instructions thru hardware

Similar presentations


Presentation on theme: "Computer Programming Methodology Instructions thru hardware"— Presentation transcript:

1 Computer Programming Methodology Instructions thru hardware
COS 130 Computer Programming Methodology Instructions thru hardware

2 Sign in sheet

3 Algorithm Like a Recipe, but . . . Strictly defines the order of steps
“In mathematics and computing, an algorithm is a procedure (a finite set of well-defined instructions) for accomplishing some task which, given an initial state, will terminate in a defined end-state.” - Wikipedia Like a Recipe, but . . . Strictly defines the order of steps

4 Program “A computer program is a list of instructions
to be executed by the computer.” - Wikipedia Programs implement algorithms Programs are executable by “machines” Programs group instructions into a unit of work

5 Instructions Noun and a Verb Examples: Kick ball Print “Hello World”

6 Problem Solving Decomposition How do you eat an elephant?
One bite at a time! Break big problems into little problems

7 Problem Solving with Instructions
Based on Verbs? Based on Nouns? Example: Make a pie

8 Verbs Make Apple pie prep assemble cook Wash apples Slice apples
Combine dry ingredients Coat apples With brown sugar Place pie In oven Pre-heat oven

9 Nouns Apple Pie Crust Filling Flour Apples Eggs Brown Sugar Sugar
Cinnamon

10 Verbs vs. Nouns Verbs Solve Top Down Nouns Solve Bottom Up Plato
Aristotle Structured Programming Object Oriented Programming

11 However, eventually we revert to verbs
More about Nouns Already in the problem domain waiting to be discovered Concrete – see, hear, touch, taste them More permanent Class registration example However, eventually we revert to verbs

12 What Makes Computers Different?

13 When implemented on a computer
Noun Data Verb Instruction

14 Flexible Data Representation
Herman Hollerith and the 1890 census IBM Archives -

15 Flexible Instruction Representation
Wikipedia - Wikipedia - Jacquard loom

16 Combine Flexible Data with Flexible Instructions
Data is represented as 1’s and 0’s Instructions are represented as 1’s and 0’s Therefore we can write programs that manipulate programs as their data Examples: Compilers Operating Systems This should make your head hurt!

17 National Science Museum of the UK
Data and Instructions National Science Museum of the UK Babbage’s Engines – 1830’s

18 A Brief Introduction to Computer Hardware

19 Top Level Hardware CPU I/O Devices Memory Storage High Speed
The “Brain” Performs Arithmetic Controls Execution CPU I/O Devices Memory Storage High Speed Long term storage Access to the outside

20 Wikipedia - http://en.wikipedia.org/wiki/Central_processing_unit
CPU Details Program Counter Arithmetic Logic Unit Wikipedia -

21 Memory Details . . . . . . A sequence of storage locations
1024 1025 1026 1027 1028 1029 1030 1031 A sequence of storage locations Much like mailboxes Each box has an address Each box can hold 32 bits Each box can be randomly accessed Goes away when the power is turned off

22 I/O Details Slower than memory Varies depending on the device
Accessed differently then memory usually read / write Disks are special they are often used as faux memory

23 Hardware Philosophy Simple – add, compare, move
Speed more important than sophistication Lots of simple steps fast to get results Keep the CPU busy Driven by a “clock”, everything must happen on the beat

24 Assignment Operator = maxStudents = 30; Left side must be a variable
The value from the right is put in the spot in memory named on the left . . . 30 maxStudents

25 maxStudents – curEnroll
Example seatsLeft = maxStudents – curEnroll ; . . . 33 curEnroll . . . -3 -3 seatsLeft . . . 30 maxStudents

26 Wikipedia - http://en.wikipedia.org/wiki/Central_processing_unit
Example in the CPU Fetch Instruction MV Mem R3 MV Mem R7 Add R3, R7, R2 MV R2 Mem Program Counter Arithmetic Logic Unit Wikipedia -


Download ppt "Computer Programming Methodology Instructions thru hardware"

Similar presentations


Ads by Google