Ch. 9: Executing Instructions
Ch. 1: Computation's Greatest Hits
Ch. 2: User Interface
Ch. 3: Networking
Ch. 4: HTML
Ch. 5: Web Searching
Ch. 7: Bits and Bytes
Ch. 8: Multimedia Encoding
Ch. 6: Debugging
Ch. 9: Executing Instructions
Ch. 10: Algorithms
Programming and Python
Ch. 11: Computers and Society
Ch. 12: Privacy and Security
Ch. 13: Spreadsheets
Ch. 15: Database Introduction
Ch. 22: Limits
While running, computers follow instructions literally.
No creativity, imagination or intuition.
No will; no intentions, desires, purposes or goals.
No sense of humor.
No “common sense”.
No sense of proportion or reasonableness.
No notion of context.
Instructions are very small.
Instructions are unambiguous.
Decide if 5 is less than 6.
Don't decide if grits are better than oatmeal.
Computers follow clear rules; they do not exercise judgment.
Fetch-execute cycle. Constantly repeats:
Instruction Fetch (IF).
Instruction Decode (ID).
Data Fetch (DF).
Instruction Execution (EX).
Result Return (RR).
Memory: Numbered mailboxes.
Arithmetic and Logic Unit.
Logical ops: And, Or, etc.
Input and output.
Interface devices: Display, keyboard, mouse, etc.
Storage devices: Disks, etc.
Follows the program.
Tells the others what to do.
Central Processing Unit (CPU) = ALU + Control Unit.
Instructions are stored in memory.
Control unit contains a
(PC) holding address of the next instruction.
Instructions must be brought into the CPU for execution.
ALU operates on values in
in the CPU.
Data must be moved between registers and memory.
ADD 800, 428, 884
the instruction execution page
demonstrates instruction execution.
Coded on a PC:
A1AC010000 mov eax,  030574030000 add eax,  A320030000 mov , eax
More is better.
Traditionally, there was a single CPU to do all processing.
Trend is multiple CPUs.
Multiple cores: More than one CPU constructed in a single chip.
Multiple CPU chips in the same motherboard.
A separate processor specialized to graphics tasks to let the CPU do other things.
Organized as a large number of small, coordinated processors.
An display image can be divided into regions, each handled one of these processors.
Periodically generates a pulse to make the CPU do the next thing.
Clock period: Time between pulses.
Number of periods per second.
Reciprocal of the period.
Hertz (Hz): Cycles/second.
Megahertz (MHz): Millions of cycles/second.
Gigahertz (GHz): Billions of cycles/second.
Traditionally, each clock is one step of the fetch-execute cycle.
Newer approach is to overlap.
More like an assembly line.
Constructed from a large number of small instructions.
Each instruction is coded as a number.
Example is assembly language: op arg1, arg2, arg2.
High-level languages: a = a + b;
Translated using a
Application programs require services from the operating system.
OS is resource manager and traffic cop.
Running multiple programs and keeping them apart.
Assigns parts of memory to the various programs running.
When you click, load the first part of the program into memory.
Loads other parts as needed.
Operating devices (drivers).
Creating and managing files and folders.
PC Operating systems: Windows, MacOS, Linux
Several versions of each.
Other OS's: iOS, Android, ChromeOS.
Programmers reuse existing code.
Libraries provide procedures for common operations.
When is a thousand not a thousand?
Byte: 8 bits.
Each byte stores one character.
Four bits: nibble.
Four bytes often called a “word.”
Kilobyte = 2
bytes = 1024 bytes.
Megabyte = 2
bytes = 1024
Gigabyte = 2
Items Stored In Memory
Each slot in memory is typically one byte. Larger items are stored in adjacent cells which are stored or fetched in groups.
Integer values typically use four bytes.
A typical instruction occupies four bytes.
Different types of CPU use different sizes.
On some types of CPU, instructions are not all the same size.
New PCs and laptops typically have 4 Gigabytes of memory or more. Older ones may have 1 or 2.
Typical desktop hard disks are 500 Gigabytes to 2 Terabytes. Laptops on the low end of that.
Trend to internal flash, especially on laptops.
More expensive and smaller.
Faster and lower power.
Typical sizes 128 or 256 Gigabytes.
Whole device created at once.
Photoresist is exposed to UV through a mask, leaving a shadow.
Acid washes exposed photoresist, exposing the layer below. The exposed material is removed by hot gasses.
Remaining resist is removed.
Silicon is doped to so it can function as a transistor.
Additional layers and wires are deposited.
Transistors: Controlled switches.
Connect transistors to compute combinations.