Computer Architecture CS 110 Fall 2005 Review Humans devise algorithms to solve problems Humans implement an algorithm in a high-level programming language • Program • Software Compiler translates program into machine code Machine executes the machine code (version of the algorithm) Review Recall the “Deal a Hand of Poker” algorithm • For each of five cards For each person sitting at the table • Hand that person a card face down There’s memory involved • How many cards have I handed out? • Which person gets the next card? • What card is next on the deck? Algorithms and Memory Computers are simple machines (conceptually) • Algorithms (steps of actions) • Memory (the subjects and objects of the actions) Conveniently, algorithms are stored in memory (as programs) • Von Neumann architecture Algorithms and Memory Your web browser is algorithm and memory • Accepts input from you (URLs) Stores in memory • Sends requests for html on Internet Uses memory to remember that request is pending • Receives html from web servers Collects packets, reorganizes them, and stores whole • Reads the html to identify text, pictures, formatting instructions Access memory • Displays the desired information on the screen Stores formatted web page for display Computer Architecture Computer (the physical device) emphasizes two elements • CPU for running algorithms • RAM, disk, flash drives, CDs for storing memory • Bus A means of moving data from memory to CPU Computer Architecture CPU Bus Memory Computer Architecture CPU Instructions: Read memory Write memory Bus Memory Computer Architecture CPU Example: Read (104) Bus Memory Computer Architecture CPU Example: Read (104) Bus 100 104 Memory 108 112 116 “a” Computer Architecture CPU Example: “a” Bus 100 104 Memory 108 112 116 “a” Memory Conceptually • Data that is stored as “words” and organized with numerical “addresses” Physically • Data is stored on disks, chips, CDs, etc. Abstraction • The physical location of the memory is irrelevant to the CPU Combining CPU / Memory Fetch / Execute cycle • Basic repetitive process going on inside computer for all tasks CPU “fetches” next step (instruction) of algorithm CPU executes next step of algorithm • A legal step is to do nothing Combining CPU / Memory Three basic “steps” of each fetch/execute cycle • Arithmetic or logical Add, Multiply, NOT • Memory operations Load, store • Control flow If a, then b Fetch / Execute Fetch / Execute cycle serves to synchronize all computer tasks • • • • Reading and writing to memory Displaying to screen Acquiring user input from keyboard Sending music to speakers A 1 hertz (Hz) CPU executes 1 fetch/execute cycle per second A 1 gigahertz (GHz) CPU executes 1 Billion fetch/execute cycles per second Architecture