CS 311 EXAM 2 (MONEY MAKER!!!!!!!!!!!!!!!)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/94

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:56 AM on 10/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

95 Terms

1
New cards

Tradeoff: Harvard vs Von Neumann

Harvard trades flexibility for optimization; Von Neumann trades some optimization for flexibility (the common choice).

2
New cards

Von Neumann architecture

ONE memory for instructions and data. Flexible (split can change as you go). Used by almost all computers.

3
New cards

Harvard architecture

TWO separate memories (instructions, data). Each can be optimized, but inflexible: sizes fixed up front, can't share spare space.

4
New cards

Design tradeoff (say this on the exam)

A balance among competing goals (cost, speed, power, instruction size, programmer convenience). Improving one hurts another.

5
New cards

Tradeoff: fixed vs variable length

Fixed wastes memory but is faster; variable saves memory but is slower to decode.

6
New cards

Fixed-length instructions

All same size: wastes memory but MUCH faster to fetch/decode (parallel hardware).

7
New cards

Variable-length instructions

Different sizes: saves memory but decoding is iterative and slower.

8
New cards

Iterated in space

Hardware uses parallel copies (one per bit) to work on all bits at once. This is why fixed-length is fast.

9
New cards

Tradeoff: operand counts

More operands = fewer, easier instructions but longer; fewer operands = smaller instructions but more of them. Max is 3.

10
New cards

Tradeoff: CISC vs RISC

CISC: powerful compact programs but complex hardware and slower instructions. RISC: simple fixed-size instructions that finish one per cycle, but more instructions per program.

11
New cards

Tradeoff: SRAM vs DRAM

SRAM fast but power-hungry and big; DRAM slower but low power and dense (so main memory).

12
New cards

Tradeoff: registers vs memory

Registers are very fast but few; memory is large but slow. Keep values you will reuse in registers (eases the Von Neumann bottleneck).

13
New cards

Tradeoff: immediate values

Fast, no register or memory needed, but the value must be known ahead of time and is limited by the bits in the instruction.

14
New cards

Five conceptual units of a processor

Controller, ALU, local data storage (registers), internal interconnection (data path), external interface. Memory and I/O are NOT inside.

15
New cards

Controller

The heart: steps through the program and coordinates all other units.

16
New cards

ALU

Does computation (math, shifts, Boolean). ONE operation at a time, only when the controller directs it. No storage of its own.

17
New cards

External interface

Connects the processor to memory and I/O devices (buses = parallel wires).

18
New cards

Five pipeline stages (in order)

Fetch, Decode, Execute, Memory, Store (F-D-E-M-S).

19
New cards

Pipeline throughput

Once full with no stalls, one instruction finishes every clock cycle (first one in cycle 5).

20
New cards

Stall

A stage must wait, usually because an instruction needs a result an earlier one hasn't produced.

21
New cards

Bubble

The gap a stall sends down the pipeline.

22
New cards

Causes of stalls

Data dependency, branch to a new location, subroutine call, invoking a coprocessor.

23
New cards

Fixes for stalls

Reorder instructions, insert NOP (software); forwarding (hardware).

24
New cards

Forwarding

Hardware passes the ALU result directly to the next instruction's ALU input, avoiding a stall.

25
New cards

NOP

No operation: executes but does nothing; burns a cycle.

26
New cards

ISA (instruction set architecture)

Instruction set + instruction representation. Interface between software and hardware.

27
New cards

ISA part 1: instruction set

The operations the hardware executes, the values they work on, and the results they produce.

28
New cards

ISA part 2: instruction representation

The binary format of instructions: which bits are opcode, which are operands.

29
New cards

IBM System/360

A family of small/medium/large computers sharing ONE ISA, so software ran on all. Same instructions, different implementations.

30
New cards

Fetch-execute cycle

Repeat forever: fetch the next instruction, execute it. The processor never stops; it only fetches and executes.

31
New cards

Instruction (two parts)

Opcode + operand(s).

32
New cards

Opcode

Binary code that uniquely identifies the instruction.

33
New cards

Operand

Value an instruction needs: a register, a memory address, or an immediate value.

34
New cards

Zero-operand (stack)

Operands are implicit, on top of a stack. A = B + C: push B, push C, add, pop A.

35
New cards

One-operand

Implicit accumulator register holds one operand and the result. A = B + C: load B, add C, store A.

36
New cards

Two-operand

Result overwrites the second operand. A = B + C: move B A (copy B into A), then add C A (A gets A + C).

37
New cards

Three-operand

Third operand is an explicit destination. A = B + C: add B C A (one instruction). Fewer instructions, but each is longer.

38
New cards

Operand cost order

Immediate < register < direct memory < indirect < double indirect.

39
New cards

Immediate value

The data itself stored in the instruction. Fast, but value must be known ahead and is size-limited.

40
New cards

Result operand can never be

An immediate value (must be a register or memory address).

41
New cards

Implicit vs explicit operand encoding

Implicit: type in opcode (many opcodes). Explicit: type field in each operand (bigger operands).

42
New cards

Stack

LIFO data structure.

43
New cards

Reverse Polish notation

Operands first, operator last (A B +). How stack machines work.

44
New cards

Register-offset operand

Register plus an offset; great for struct fields.

45
New cards

Direct vs indirect vs double indirect

Direct: operand names the address. Indirect: address is held in a register/memory. Double indirect: pointer to a pointer (slowest).

46
New cards

SRAM

Latch-based: fast, but high power/heat and takes more space.

47
New cards

DRAM

Capacitor-based (charged = 1): lower power, denser, but must be refreshed.

48
New cards

Refresh

Circuit that continuously rewrites every DRAM bit before its charge leaks away.

49
New cards

Volatile

Loses contents when power is off (both SRAM and DRAM).

50
New cards

Word address and offset

W = B div N, O = B mod N. With N a power of 2 it's just bit extraction (low bits = offset).

51
New cards

Byte address 17, 4-byte words: word and offset?

Word 4, offset 1 (17 = 4x4 + 1). In binary 10001: low 2 bits (01) = offset, the rest (100) = word.

52
New cards

Byte address 11, 4-byte words: word and offset?

Word 2, offset 3 (11 = 2x4 + 3).

53
New cards

Address size

k bits = 2^k bytes. 32-bit = 4 GB (gigabytes). 64-bit = 2^64 bytes.

54
New cards

Alignment

N-byte item starts at a multiple of N. Unaligned = exception or slow read-modify-write.

55
New cards

Struct padding tip

Order members largest to smallest to save space.

56
New cards

Memory banks

Identical modules joined into one big memory; helps keep code and data separate.

57
New cards

Interleaving

Consecutive words in different modules; low bits pick the module; helps sequential access.

58
New cards

SDRAM / DDR / QDR

Synchronous clock with the processor / double data rate / quad data rate (power-of-2 multiples).

59
New cards

Fetch-store paradigm

Memory can only fetch (read) and store (write). Store overwrites; nothing is deleted.

60
New cards

Why registers/cache are faster than RAM

They are on the chip: shorter electron travel and smaller.

61
New cards

Pointer

A variable holding a memory address. Memory has no pointer types; the compiler does.

62
New cards

Memory Levels 0 / 1 / 2

Level 0: individual bits. Level 1: array of bytes addressed from 0. Level 2: word-address architecture (bytes grouped into words).

63
New cards

Memory dump row

A hex listing of memory, 16 bytes per row, so adjacent row addresses differ by 16.

64
New cards

FF in hex

255 = 2^8 - 1 (one byte = two hex digits).

65
New cards

Four processor types (least to most flexible)

Fixed, selectable, parameterized, programmable.

66
New cards

Fixed logic

Hardwired for one task.

67
New cards

Selectable logic

Control lines choose among functions (e.g., an ALU).

68
New cards

Parameterized logic

One function whose behavior is set by parameters (e.g., hash with constants p and q).

69
New cards

Programmable logic

Steps come from a program in memory; can change each time.

70
New cards

Coprocessor

Special-purpose processor under another processor's control (e.g., floating point accelerator).

71
New cards

Microcontroller

Programmable processor that controls a physical system (car engine, door); program usually in ROM.

72
New cards

Program counter / instruction pointer

Holds the address of the next instruction.

73
New cards

Clock rate vs instruction rate

NOT the same. Floating point multiply/divide, memory, and I/O take extra cycles.

74
New cards

Bootstrapping

Startup: boot code (boot loader) loads the OS from a device into memory and branches to it.

75
New cards

Pipeline transparency

Results are the same with or without a pipeline; it only affects speed.

76
New cards

CISC

Many complex, variable-size instructions (e.g., Intel x86).

77
New cards

RISC

Small set of simple, fixed-size instructions; one completes per cycle (ARM, MIPS, SPARC).

78
New cards

Why MIPS is RISC

Small instruction set (well under 50) and simple fixed-size instructions.

79
New cards

Von Neumann bottleneck

Every fetch-execute cycle reads RAM at least once, so memory limits speed. Fix: keep data in registers.

80
New cards

Register

Memory on the CPU chip: very fast, fixed size (e.g., 64 bits).

81
New cards

Register allocation

Choosing which values live in registers.

82
New cards

Register spilling

Moving a register value back to memory to free the register.

83
New cards

Register banks / conflict

Operands may need different banks; same bank = conflict, fixed with an extra copy instruction.

84
New cards

Absolute branch (jump)

Loads a specific address into the program counter.

85
New cards

Relative branch

Adds a positive or negative offset to the program counter.

86
New cards

Condition codes

ALU status bits: positive, negative, zero, overflow (overflow = error).

87
New cards

Conditional branch

Tests condition codes to decide whether to branch (e.g., branch if zero).

88
New cards

Return address: stack vs register

Stack (jsr) is slower; register/link register (bl) is faster and avoids stalls.

89
New cards

ARM argument passing

First three arguments in registers, extra on the stack.

90
New cards

MIPS register 0

Always holds zero.

91
New cards

Minimalism / elegance / orthogonality

Fewest instructions / balanced and symmetric / each instruction does a unique task with no overlap.

92
New cards

Clock

Circuit (crystal-driven) that pulses at a regular rate to coordinate the processor's circuits. Hertz = cycles per second.

93
New cards

What causes a branch?

if/else, loops (repetition), and function calls.

94
New cards

Cache invalidation

Marking stored cache data as invalid so it gets overwritten; makes keeping data in fast storage tricky.

95
New cards

CAM / TCAM

Compare the key against all slots in parallel (fast, expensive, hot). TCAM adds a don't-care bit for partial/longest-prefix matches.