1 / 45

Understanding Computer Functioning Through the Fetch-Execute Cycle and Algorithms

Learn how computers work, from Turing Machines to the Von Neumann architecture, and understand the concept of algorithms. Explore the fetch-execute cycle and how computers execute instructions. Gain insight into the power of simple operations performed at high speeds.

barney
Download Presentation

Understanding Computer Functioning Through the Fetch-Execute Cycle and Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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. Contents How do computers work? Turing Machines Von Neumann architecture Fetch-execute cycle What is an algorithm? Computers and Algorithms

  3. Contents How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms

  4. 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. 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. Contents How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms

  7. 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. Input Output Von Neumann architecture (simplified) Memory Control Unit ArithmeticLogicUnit

  9. Control Unit ArithmeticLogicUnit Accumulator Input Output Von Neumann architecture Memory 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

  10. Diagram of computer memory- Each memory location is one byte size

  11. Input Output Von Neumann architecture (simplified) Memory The Control Unit: Executes instructions Control Unit ArithmeticLogicUnit

  12. Input Output Von Neumann architecture (simplified) Memory The ALU: Does the logic and maths Control Unit ArithmeticLogicUnit

  13. Input Output Devices for both input and output Memory Control Unit ArithmeticLogicUnit Hard diskFloppy disk

  14. Input Output Input devices Memory Control Unit ArithmeticLogicUnit Mouse KeyboardScanner

  15. Input Output Output devices Memory Control Unit ArithmeticLogicUnit Monitor Printer Speakers

  16. Computers on the outside Input / output Slightly out-of-date back of computer: http://facweb.northseattle.edu/tfiegenb/EET131/GX150User/about.htmAccessed 17-11-08

  17. RAM

  18. 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) 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

  19. Contents How do computers work? Turing Machines Von Neumann architecture Fetch execute cycle What is an algorithm? Computers and Algorithms

  20. The fetch/execute cycle.

  21. Illustration of a single ADD 2000 2080 4000 instruction Results depend on the contents of the memory locations referenced in the instruction.

  22. Computer before executing an ADD instruction.

  23. 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. Computer before executing an ADD instruction - again

  25. Instruction Fetch: Move instruction from memory to the control unit.

  26. Instruction Decode: Pull apart the instruction, set up the operation in the ALU, and compute the source and destination operand addresses.

  27. Data Fetch: Move the operands from memory to the ALU.

  28. Execute: Compute the result of the operation in the ALU.

  29. Result Return: Store the result from the ALU into the memory at the destination address.

  30. Contents How do Computers Work? What is an algorithm?Example Algorithms

  31. What is an algorithm? An algorithm is an ordered set of unambiguous, executable steps that defines a terminating processBrookshear 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. 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. Everyday examples of algorithm-like procedures • Recipes • Flat-pack assembly instructions (sometimes – sometimes not) • Directions • Instructions on vending machines

  34. Five properties of algorithms • Input-specified • Output-specified • Definiteness • Effectiveness • Finiteness Fluency with IT by Lawrence Snyder

  35. 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. 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. 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. Effectiveness • Can be executed without additional input, information from … or us or oracles or psychics, ...

  39. 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. Contents How do Computers Work? What is an algorithm?Example Algorithms

  41. 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 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 ...)

  42. 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. 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]

More Related