------------------------------------------------------------------------------
MC logo
Ch. 9: Executing Instructions
[^] Chapter Outlines
------------------------------------------------------------------------------
<<Ch. 10: Algorithms Programming and Python>>
  1. Computer Instructions.
    1. While running, computers follow instructions literally.
      1. No creativity, imagination or intuition.
      2. No will; no intentions, desires, purposes or goals.
      3. No sense of humor.
      4. No “common sense”.
        1. No sense of proportion or reasonableness.
        2. No notion of context.
    2. Instructions are very small.
    3. Instructions are unambiguous.
      1. Decide if 5 is less than 6.
      2. Don't decide if grits are better than oatmeal.
      3. Computers follow clear rules; they do not exercise judgment.
    4. Fetch-execute cycle. Constantly repeats:
      1. Instruction Fetch (IF).
      2. Instruction Decode (ID).
      3. Data Fetch (DF).
      4. Instruction Execution (EX).
      5. Result Return (RR).
  2. Computer Anatomy.
    1. Memory: Numbered mailboxes.
      1. Addresses.
      2. Values.
      3. Limited capacity.
    2. Arithmetic and Logic Unit.
      1. Arithmetic.
      2. Comparisons.
      3. Logical ops: And, Or, etc.
    3. Input and output.
      1. Interface devices: Display, keyboard, mouse, etc.
      2. Storage devices: Disks, etc.
    4. Control.
      1. Follows the program.
      2. Tells the others what to do.
    5. Central Processing Unit (CPU) = ALU + Control Unit.
  3. Instruction execution.
    1. Instructions are stored in memory.
    2. Control unit contains a program counter (PC) holding address of the next instruction.
    3. Instructions must be brought into the CPU for execution.
    4. ALU operates on values in registers in the CPU.
    5. Data must be moved between registers and memory.
    6. Example instruction: ADD 800, 428, 884

      Instruction Fetch

      Instruction Decode

      Data Fetch

      Execute

      Result Return
  4. Clock
    1. Periodically generates a pulse to make the CPU do the next thing.
    2. Clock period: Time between pulses.
    3. Clock rate.
      1. Number of periods per second.
      2. Reciprocal of the period.
      3. Units.
        1. Hertz (Hz): Cycles/second.
        2. Megahertz (MHz): Millions of cycles/second.
        3. Gigahertz (GHz): Billions of cycles/second.
    4. Traditionally, each clock is one step of the fetch-execute cycle.
    5. Newer approach is to overlap.
      1. Called pipelining.
      2. More like an assembly line.
  5. Programs.
    1. Constructed from a large number of small instructions.
    2. Each instruction is coded as a number.
    3. Example is assembly language: op arg1, arg2, arg2.
    4. High-level languages: a = a + b;
      1. Most programs.
      2. Translated using a compiler:
    5. Application programs require services from the operating system.
      1. Memory management. Usually virtual memory.
      2. Operating devices.
      3. Creating files.
      4. Running programs and keeping them apart.
    6. Programmers reuse existing code.
      1. Programs evolve.
      2. Libraries provide procedures for common operations.
  6. Memory sizes. When is a thousand not a thousand?
    1. Byte: 8 bits.
    2. Each byte stores one character.
    3. Four bits: nibble.
    4. Kilobyte = 210 bytes = 1024 bytes.
    5. Megabyte = 220 bytes = 10242 bytes.
    6. Gigabyte = 230 bytes.
  7. Integrated Circuits.
    1. Miniaturization.
    2. Integration.
      1. Whole device created at once.
      2. Cheaper.
      3. More reliable.
    3. Manufacture: Photolithogoraphy.
      1. Photoresist is exposed to UV through a mask, leaving a shadow.
      2. Acid washes exposed photoresist, exposing the layer below. The exposed material is removed by hot gasses.
      3. Remaining resist is removed.
      4. Silicon is doped to so it can function as a transistor.
      5. Additional layers and wires are deposited.
    4. Transistors: Controlled switches.
    5. Connect transistors to compute combinations.
<<Ch. 10: Algorithms Programming and Python>>