Download presentation
Presentation is loading. Please wait.
1
1
2
By the end of this lecture you should be able … To describe in general terms how computers function To describe the fetch-execute cycle To explain what an algorithm is To describe the basic properties of algorithms 2
3
How do computers work? Turing Machines Von Neumann architecture Fetch-execute cycle What is an algorithm? Computers and Algorithms Contents
4
How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms Contents
5
Historical perspectives – Turing's machine Alan Turing – developed the abstract notion of a "Turing machine": –NOT a physical machine, but a mathematical model of one type of very simple abstract calculating device –He proved that there were Turing machines (Universal machines) that were capable of calculating anything and everything that any Turing machine could calculate (given enough time and enough memory) 5
6
The upshot of this result of Turing's: Very simple devices can be designed that are as powerful computers as can be (if we don't have to worry about how much time it will take or how much memory is involved) The practical lesson – make things that have larger and more efficient memory and faster speeds and we can do anything that a computer can do 6
7
How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms Contents
8
Historical perspectives: von Neumann's architecture Von Neumann added in a number of ideas that made digital computing practical and his ideas remain those of most digital programming to this day Key among those ideas: –Programmes themselves are really just like any other piece of data (0s and 1s) at least from the standpoint of the computer 8
9
Von Neumann architecture (simplified) 9 Memory InputOutput Control Unit Arithmetic Logic Unit
10
Von Neumann architecture 10 Memory InputOutput Control Unit Arithmetic Logic Unit Accumulator Stores the program and the data It has specific and discrete locations – each (generally) 1 byte Each location has a specific address These addresses store values The total size of memory locations is limited
11
Diagram of computer memory- 01010101001010100011101011101001 11 Each memory location is one byte size
12
Von Neumann architecture (simplified) 12 Memory InputOutput Control Unit Arithmetic Logic Unit The Control Unit: Executes instructions
13
Von Neumann architecture (simplified) 13 Memory InputOutput Control Unit Arithmetic Logic Unit The ALU: Does the logic and maths
14
Devices for both input and output 14 Memory InputOutput Control Unit Arithmetic Logic Unit Hard disk Floppy disk
15
Input devices 15 Memory InputOutput Control Unit Arithmetic Logic Unit Mouse Keyboard Scanner
16
Output devices 16 Memory InputOutput Control Unit Arithmetic Logic Unit Monitor Printer Speakers
17
Computers on the outside Input / output 17 Slightly out-of-date back of computer: http://facweb.northseattle.edu/tfiegenb/EET131/GX150User/about.htm Accessed 17-11-08 http://facweb.northseattle.edu/tfiegenb/EET131/GX150User/about.htm
18
RAM 18
19
Basic computer commands Extremely limited set (nothing like the range of commands that we give to computers) Designed to be simple, easy to execute but can be built up to do things that we want computers to do (like spell- checks) 19 The power of a computer does not arise from complexity. Instead, the computer has the ability to perform simple operations at an extremely high rate of speed. These operations can be combined to provide the computer capabilities that you are familiar with. The Architecture of Computer Hardware and Systems Software. By Irv Englander
20
How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms Contents
21
The fetch/execute cycle. 21
22
Illustration of a single ADD 2000 2080 4000 instruction 22 Results depend on the contents of the memory locations referenced in the instruction.
23
Computer before executing an ADD instruction. 23
24
The Program counter This keeps track of what step needs to be executed next. It uses the address of the next instruction as its way of keeping track. This is called the program counter. (Here 'PC') Some instructions change the Program counter (branch and jump instructions) 24
25
Computer before executing an ADD instruction - again 25
26
Instruction Fetch: Move instruction from memory to the control unit. 26
27
Instruction Decode: Pull apart the instruction, set up the operation in the ALU, and compute the source and destination operand addresses. 27
28
Data Fetch: Move the operands from memory to the ALU. 28
29
Execute: Compute the result of the operation in the ALU. 29
30
Result Return: Store the result from the ALU into the memory at the destination address. 30
31
How do Computers Work? What is an algorithm? Example Algorithms Contents
32
What is an algorithm? An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process Brookshear Computer Science A step-by-step procedure for solving a problem http://images.rbs.org/appendices/d_glossary_geometric.shtml A finite set of well-defined rules for the solution of a problem in a finite number of steps. http://www.sabc.co.za/manual/ibm/9agloss.htm 32
33
Algorithms for people People will think things through A general description may be enough Nonetheless, it is important to avoid ambiguity and not to make too many assumptions 33
34
Everyday examples of algorithm-like procedures Recipes Flat-pack assembly instructions (sometimes – sometimes not) Directions Instructions on vending machines 34
35
Five properties of algorithms Input-specified Output-specified Definiteness Effectiveness Finiteness 35 Fluency with IT by Lawrence Snyder
36
Specifying the input and output Input – what is going to be changed, used, transformed by the process Output – the data that carries the results at the end of the process What type (of data, of …) How much 36
37
Definiteness Each step – explicitly specified – each step in a specified order (so that at any stage it is possible to determine what the next step is May apply in different ways to different sorts of problems 37
38
From the River go to the Street and turn right Approaching a street from different directions, resulting in the instruction “turn right” having different meanings. 38
39
Effectiveness Can be executed without additional input, information from … or us or oracles or psychics,... 39
40
Finiteness Comes to an end – it stops (specify when to stop a repetition Long division: 3.3 3 ) 10.0 9 1.0 9 40
41
How do Computers Work? What is an algorithm? Example Algorithms Contents
42
Alphabetise and file your company's correspondence Input: A stack of folders. Each folder contains a letter to your company. At the moment, there is no order to the folders. Output: The same folders in the stack, but in alphabetical order 42 This is an example of sorting – Sorting is a very common algorithmic process for computers. (Here we have alphabetical sorting for example. With any of these, the efficiency of the process is important, but that's for later for now...)
43
Your problem - In groups, devise an algorithm for sorting CDs into alphabetical order. What operations can you do? (For us, what verbs – For machines what procedures or methods) What does alphabetical order mean? 43
44
Exam questions from 2009 Describe the fetch execute cycle. [4 marks] Draw a flow diagram or write in pseudo-code an algorithm for alphabetising a collection of CDs. [4 marks]
45
45
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.