Chapter 5
Physical (bits, cables) โ Data Link (frames, MAC) โ Network (packets, IP) โ Transport (segments, TCP/UDP) โ Session โ Presentation โ Application.Network Access (Physical + Data Link), Internet (Network), Transport, Application (Session + Presentation + Application).AA:BB:CC:DD:EE:FF. Layer 2 switches forward frames based on MAC address tables.802.3 = Ethernet (wired), 802.11 = Wi-Fi (wireless), 802.15 = Bluetooth, 802.16 = WiMAX.192.168.1.1), supporting ~4.3 billion addresses. IPv6 uses 128-bit addresses (e.g., 2001:db8::1), with a virtually unlimited address space.1.0.0.0โ126.255.255.255 (first octet 1-126, /8 default), Class B: 128.0.0.0โ191.255.255.255 (128-191, /16), Class C: 192.0.0.0โ223.255.255.255 (192-223, /24), Class D: 224โ239 (multicast), Class E: 240โ255 (reserved/experimental).127.0.0.1 (localhost) โ used for testing local network stack. Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.192.168.1.0/24 means first 24 bits are network. Number of hosts = 2^(32-prefix) - 2.RIP (Routing Information Protocol) โ distance-vector, metric = hop count, max 15 hops (16 = unreachable), uses Bellman-Ford. OSPF (Open Shortest Path First) โ link-state, uses Dijkstra's algorithm, no hop limit, scales better. BGP โ inter-AS (internet backbone).ping uses ICMP Echo Request/Reply. traceroute uses ICMP TTL Exceeded messages.IP address + Port number, uniquely identifying a network endpoint. A connection is identified by (source IP, source port, destination IP, destination port) โ a 4-tuple.HTTP=80, HTTPS=443, FTP=20 (data) / 21 (control), SSH=22, Telnet=23, SMTP=25, DNS=53, DHCP=67/68, POP3=110, IMAP=143.AES (Advanced Encryption Standard โ 128/192/256-bit keys), DES (56-bit, obsolete), 3DES.RSA, ECC, Diffie-Hellman (key exchange).Packet filter (stateless, examines headers), Stateful inspection (tracks connection state), Application-layer firewall (deep packet inspection).DDoS (Distributed Denial of Service โ overwhelm with traffic), Man-in-the-Middle (intercept communications), SQL Injection (malicious SQL in input), Phishing (fake websites/emails), ARP Spoofing (fake ARP replies).X.25 (packet-switched, 1970s, low speed) โ Frame Relay (faster, variable frames, 1980s) โ ATM (fixed cells, QoS, 1990s) โ MPLS (label switching, modern WAN).socket() โ bind() โ listen() โ accept() (server); socket() โ connect() (client). Both then use send()/recv(). close() terminates.Manager (collects data), Agent (runs on device), MIB (Management Information Base โ database of device info). Uses UDP port 161/162.Differentiated Services (DiffServ) marks packets; IntServ reserves bandwidth (RSVP). Important for real-time traffic like VoIP.CU (Control Unit โ fetches and decodes instructions), ALU (Arithmetic Logic Unit โ performs arithmetic and logical operations), Registers (fast on-chip storage).Fetch (PC โ MAR โ memory โ MDR โ IR), Decode (CU decodes IR), Execute (ALU performs operation, result to register or memory).PC (Program Counter โ address of next instruction), IR (Instruction Register โ current instruction), MAR (Memory Address Register), MDR (Memory Data Register), ACC (Accumulator).Structural (resource conflict), Data (RAW, WAW, WAR dependencies), Control (branches).SISD (single CPU), SIMD (GPU, vector processing), MISD (rare), MIMD (multiprocessors, multicore, distributed).Address bus (unidirectional โ CPU to memory), Data bus (bidirectional โ data transfer), Control bus (control signals โ read/write/interrupt). Bus width determines addressable memory and data transfer width.Temporal: recently used data likely reused soon. Spatial: nearby memory locations likely accessed together. Cache hit = data found; cache miss = fetch from lower memory.Direct mapping (each RAM block maps to ONE cache line โ simple, but conflicts), Fully associative (block maps to ANY cache line โ flexible, expensive), Set-associative (compromise โ block maps to a set of lines).LRU (Least Recently Used โ evict oldest unused), FIFO (First In First Out), Random, LFU (Least Frequently Used). LRU is most commonly used for its effectiveness.busy-wait). Simple but wastes CPU cycles.IN/OUT in x86). Older approach, requires separate I/O bus.Page fault = requested page not in RAM, must load from disk. TLB (Translation Lookaside Buffer) caches recent page table entries.