1
Addition/subtraction in computers is usually performed using 2's complement representation, which allows subtraction to be done as addition of the negated number.
2
Multiplication can be performed by repeated addition and shifting; Booth's algorithm speeds this up by handling strings of 1s and 0s efficiently, working correctly for both signed and unsigned numbers.
3
Division is performed by repeated subtraction and shifting, using restoring or non-restoring division algorithms.
4
Logical operations (AND, OR, XOR, NOT) and shift operations (logical shift, arithmetic shift, rotate) are performed by the ALU on binary data.
5
The memory hierarchy arranges storage by speed, cost, and capacity: CPU registers (fastest, smallest, most expensive) β cache memory β main memory (RAM) β secondary storage (disk, SSD β slowest, largest, cheapest).
6
Internal memory refers to semiconductor memory directly addressable by the CPU (RAM, ROM, cache); external memory refers to secondary storage devices (hard disk, magnetic tape, optical disks).
7
Cache memory works on the principle of locality of reference: temporal locality (recently used data is likely to be used again soon) and spatial locality (data near recently used data is likely to be used soon).
8
Cache size: larger caches improve hit rate but increase cost and access time.
9
Mapping function: direct mapping (each block maps to exactly one cache line), fully associative (a block can go anywhere), set-associative (a compromise β a block maps to a specific set of lines).
10
Replacement algorithm: LRU (Least Recently Used), FIFO (First-In-First-Out), LFU (Least Frequently Used), Random β used when a new block must replace an existing one, needed for associative/set-associative mapping.
11
Write policy: write-through (writes go to cache and main memory simultaneously β simple, more traffic) vs write-back (writes go to cache only; main memory updated later when the block is replaced β less traffic, more complex).
12
Modern systems commonly use multiple cache levels: L1 (fastest, smallest, per-core), L2, and L3 (larger, shared, slower).
13
RAM (Random Access Memory) is volatile and both readable and writable; it loses data on power loss. ROM (Read-Only Memory) is non-volatile and normally only readable after manufacture.
14
PROM (Programmable ROM) can be written once by the user; EPROM is erased using UV light then reprogrammed; EEPROM/Flash are electrically erasable and reprogrammable, non-volatile.