Computer Architecture Cheat Sheet

Computer System Components

ComponentFunctionCharacteristicsPerformance Metrics
CPU (Central Processing Unit)Execute instructions, perform calculationsALU, Control Unit, RegistersClock speed, MIPS, FLOPS
Memory (RAM)Store data and instructions temporarilyFast access, volatileCapacity, speed, bandwidth
StorageStore data permanentlyNon-volatile, high capacityCapacity, access time, transfer rate
Cache MemoryStore frequently accessed dataFast, small, expensiveHit rate, access time
I/O DevicesInterface with external worldVarious speeds and protocolsTransfer rate, response time
System BusConnect componentsData, address, control linesBandwidth, speed

Instruction Set Architecture (ISA)

AspectDescriptionExamplesTrade-offs
Instruction TypesCategories of operationsData transfer, ALU, control, I/OFlexibility vs. simplicity
Addressing ModesHow operands are specifiedImmediate, direct, indirect, registerFlexibility vs. complexity
CISCComplex Instruction Set ComputerIntel x86, VAXRich instructions vs. complex hardware
RISCReduced Instruction Set ComputerARM, MIPS, PowerPCSimple instructions vs. more instructions
Instruction FormatStructure of machine instructionsOpcode + operandsFixed vs. variable length

Processor Architecture

FeatureDescriptionAdvantagesDisadvantages
Single CycleExecute each instruction in one clock cycleSimple control, predictable timingWaste of resources, long cycle time
Multi-cycleExecute instructions in multiple cyclesBetter resource utilizationMore complex control
PipelinedOverlapping execution of instructionsHigher throughputComplexity, pipeline hazards
SuperscalarMultiple execution units in parallelMultiple instructions per cycleHigh power, complexity
VLIWVery Long Instruction WordExplicit parallelismCompiler complexity, code bloat
Out-of-Order ExecutionExecute instructions when operands readyBetter performanceComplex hardware

Memory Hierarchy

LevelTypeSpeedCost per ByteCapacityFunction
RegistersSRAMFastestHighestSmallestCPU internal storage
L1 CacheSRAMVery FastHighSmallImmediate data access
L2 CacheSRAMFastMediumMediumBackup to L1 cache
L3 CacheSRAMMediumLowLargeShared cache for cores
Main MemoryDRAMSlowLowestLargeProgram storage
Secondary StorageSSD/HDDSlowestLowestLargestPermanent storage

Cache Memory

ConceptDescriptionType/MethodTrade-offs
MappingHow memory blocks map to cacheDirect, associative, set-associativeSpeed vs. hit rate vs. complexity
Write PolicyHow writes are handledWrite-through, write-backConsistency vs. speed
Replacement PolicyWhich block to replaceLRU, FIFO, RandomPerformance vs. implementation
Cache Miss TypesReasons for cache missesCompulsory, capacity, conflictDesign optimization
Cache CoherenceKeeping caches consistentDirectory-based, snoopingPerformance vs. consistency

Memory Management

TechniqueDescriptionAdvantagesDisadvantages
SegmentationDivide memory into logical segmentsNatural program structure, sharingExternal fragmentation
PagingDivide memory into fixed-size pagesNo external fragmentationInternal fragmentation
Virtual MemoryExtend physical memory with diskLarger address spacePerformance overhead
Page TablesMap virtual to physical addressesFlexible mappingMemory overhead
TLBTranslation Lookaside BufferFast address translationSmall, expensive

Pipeline Hazards

Hazard TypeCauseExampleSolutions
StructuralResource conflictsTwo instructions need same ALUMore resources, stalling
DataData dependenciesInstruction 2 needs result of Instruction 1Forwarding, stalling, reordering
ControlBranch instructionsBranch direction affects next instructionsBranch prediction, delay slots

Performance Metrics

MetricDefinitionFormulaUse Case
Clock RateSpeed of processor clockCycles per second (Hz)Basic performance indicator
CPI (Cycles Per Instruction)Average cycles per instructionTotal cycles / Total instructionsArchitecture comparison
MIPS (Million Instructions Per Second)Instruction execution rateInstructions / (time in seconds × 10⁶)Overall performance
ThroughputWork completed per unit timeTasks completed / timeSystem performance
Response TimeTime to complete taskCompletion time - Start timeUser experience
SpeedupPerformance improvementOld time / New timeComparison of systems

Parallel Processing

ApproachDescriptionCharacteristicsBest For
Instruction Level ParallelismExecute multiple instructions simultaneouslyPipelining, superscalar, VLIWSingle thread optimization
Data Level ParallelismPerform same operation on multiple data itemsVector processors, SIMDScientific computing, graphics
Thread Level ParallelismExecute multiple threads simultaneouslyMulti-core, hyper-threadingMulti-threaded applications
Task Level ParallelismExecute independent tasks in parallelMulti-processing, distributed systemsIndependent computations

Bus Architecture

Bus TypeFunctionCharacteristicsPerformance Factors
Data BusTransfer data between componentsBi-directional, width variesWidth, frequency, protocols
Address BusSpecify memory addressesUnidirectional, determines addressable memoryWidth (2^n addressable locations)
Control BusControl signal transmissionRead/write, interrupt, clock signalsSignal integrity, timing
System BusConnect CPU to memoryHigh-speed, connects major componentsBandwidth, latency
I/O BusConnect I/O devicesVarious standards, slowerStandard compatibility