Blocking vs Non-blocking I/O: How a Thread Waits for Data

Overview Blocking and non-blocking I/O differ in what happens to the calling thread when a read or write can’t complete immediately. Blocking I/O suspends the thread until data is ready; non-blocking I/O returns at once and lets the caller check back later. The choice shapes how a system scales to many simultaneous connections. Comparison Diagram Blocking I/ONon-blocking I/OThreadcall read()thread blockedno other work possibleuntil data arrivesdata ready, resumes1 thread ≈ 1 in-flight callthread / event loopread() returns at oncepoll / epoll checkretrymeanwhile: serves otherconnectionsready → callback fires1 thread ≈ many in-flight calls Comparison Table Aspect Blocking I/O Non-blocking I/O Call behavior Call halts the calling thread until the operation completes Call returns immediately, with data or an EWOULDBLOCK/EAGAIN error Thread state while I/O is pending Thread is suspended off the run queue — no CPU used, but unavailable for other work Thread stays runnable and can be reused to serve other requests How readiness is discovered OS wakes the thread automatically once data is ready Caller polls or registers with select/poll/epoll/kqueue Concurrency model One thread (or process) per concurrent connection Single or few threads multiplex many connections via an event loop Resource overhead at scale Grows linearly with connections — thread stacks, context switches Stays flat, bounded by CPU cores rather than connection count Code / control-flow complexity Simple, sequential, top-to-bottom logic Callback, promise, or async/await structure; state tracked across suspensions Failure / edge-case handling A slow or hung peer blocks the thread indefinitely without a timeout A slow peer only delays its own event; a stalled callback can starve the whole loop Key Differences Blocking I/O ties up a thread for the full call; non-blocking frees it immediately. Non-blocking servers rely on an event loop to learn when data is finally ready. Blocking scales concurrency with more threads; non-blocking scales with more callbacks on fewer threads. Blocking code reads sequentially; non-blocking code needs explicit state management across suspensions. At high connection counts, blocking hits a C10K wall that non-blocking avoids. When to Use Each Blocking I/O ...

August 2, 2026 · 3 min · 488 words · jeonck

Latency vs Bandwidth: Delay vs Capacity

Overview Latency and bandwidth both describe network performance, but they measure completely different things: latency is how long a single piece of data takes to travel from source to destination, while bandwidth is how much data can move through the connection per second. A link can have huge bandwidth and still feel laggy, or tiny bandwidth and still respond instantly — understanding which one is limiting you determines whether the fix is a faster link or a shorter path. ...

August 1, 2026 · 3 min · 481 words · jeonck

Circuit Switching vs Packet Switching: Dedicated Paths vs Independent Packets

Overview Circuit switching and packet switching are the two fundamental ways a network can move data between endpoints. Circuit switching reserves a dedicated path for the full duration of a session, like a traditional phone call, while packet switching breaks data into independent packets that share network links and find their own way to the destination. The choice affects everything from latency predictability to how efficiently bandwidth gets used. Comparison Diagram Circuit Switching Packet Switching A B Dedicated path reserved for the entire call A B 1 2 Packets routed independently, paths may differ, may arrive out of order Comparison Table Aspect Circuit Switching Packet Switching Connection setup Requires an explicit call-setup phase (signaling) before any data flows No setup phase; data is sent as soon as packets are ready Path allocation A fixed end-to-end path is established and used for the whole session No fixed path; each packet is routed hop-by-hop and may take a different route Resource reservation Bandwidth is exclusively reserved, so idle time on the circuit is wasted Bandwidth is statistically multiplexed and shared among many flows Data transfer format Continuous stream of data sent in the order it was generated Data split into discrete packets, each carrying its own header for routing Latency and jitter Predictable, constant latency once the circuit is established Variable latency and jitter caused by queuing and differing routes Ordering and reliability Data always arrives in the order sent, since the path never changes Packets can arrive out of order or be lost, requiring reassembly/retransmission Failure handling A link failure breaks the whole call, forcing re-establishment Traffic can be dynamically rerouted around a failed link Session teardown An explicit signal releases the reserved circuit when the call ends No teardown needed; the flow simply stops when packets stop being sent Key Differences Circuit switching reserves a dedicated path for the whole session; packet switching has no fixed path at all Circuit switching wastes idle capacity through exclusive reservation, while packet switching relies on statistical multiplexing to share bandwidth Packets can be independently rerouted around failures, while a circuit failure kills the entire call Circuit switching guarantees ordered, steady-latency delivery; packet switching risks out-of-order arrival and jitter A circuit needs an explicit call setup phase before data flows, while packet switching starts transmitting immediately When to Use Each Circuit Switching ...

August 1, 2026 · 3 min · 528 words · jeonck

Full Duplex vs Half Duplex: Simultaneous vs Alternating Communication

Overview Full duplex and half duplex describe how a communication link handles data flowing in both directions. A full duplex link sends and receives at the same time over independent paths, while a half duplex link shares a single channel and must alternate between sending and receiving. The distinction determines whether devices collide, how much of the link’s bandwidth is usable, and how much delay is added when a device switches from listening to talking. ...

August 1, 2026 · 3 min · 433 words · jeonck

MAC Address vs IP Address: Hardware Identity vs Network Location

Overview A MAC address is a hardware identifier burned into a network interface card and used to move frames across a single local link. An IP address is a logical network address assigned to a device and used to route packets across interconnected networks, including the internet. They operate at different OSI layers, working together to get data from one physical wire to a destination anywhere in the world. Comparison Diagram Host AIP 10.0.0.5Routerrewrites MAC per hopHost BIP 10.0.0.9MAC AA:01 to MAC RR:01MAC RR:02 to MAC BB:01Layer 2 - MAC changes at every hopIP 10.0.0.5 to 10.0.0.9Layer 3 - IP stays constant end-to-endMAC = local hop identity; IP = end-to-end address Comparison Table Aspect MAC Address IP Address OSI layer Layer 2 (Data Link) Layer 3 (Network) Format 48-bit hex, e.g. 00:1A:2B:3C:4D:5E 32-bit (IPv4) or 128-bit (IPv6) dotted/colon notation Assignment Burned in by the NIC manufacturer at production Assigned by a network admin or DHCP server Structure Flat, no hierarchy — vendor prefix plus serial Hierarchical — network portion plus host portion for routing Persistence Fixed to the physical interface (though spoofable) Can change when a device moves to a different network Role in delivery Identifies the next-hop device on the local link Identifies source and destination across the whole path Behavior across hops Rewritten by every router at each hop Preserved end-to-end (barring NAT) Resolution mechanism Discovered via ARP (IPv4) or NDP (IPv6) Discovered via DNS for hostnames Key Differences MAC address operates at Layer 2 while IP address operates at Layer 3. MAC is burned into hardware by the manufacturer, whereas IP is assigned by the network. A frame’s MAC addresses are rewritten at every hop, but the packet’s IP addresses stay end-to-end constant. ARP maps an IP address to the MAC address needed for delivery on the local segment. MAC addresses are flat with no structure, while IP addresses are hierarchical to support routing. When to Use Each MAC Address ...

August 1, 2026 · 3 min · 440 words · jeonck

Ping vs Traceroute: Testing Reachability vs Mapping the Path

Overview Ping and Traceroute are both ICMP-based diagnostic tools, but they answer different questions: ping tests reachability between two hosts, while traceroute reveals the path packets take to get there. Ping reports simple round-trip latency and packet loss; traceroute manipulates TTL values to map every router hop along the route. Comparison Diagram PINGTRACEROUTEClientServerEcho RequestEcho ReplyOne round trip → RTT to destinationClientR1R2R3SrvTTL=1TTL=2TTL=3TTL=4Time Exceeded replyEach probe's TTL expires one hop further Comparison Table Aspect Ping Traceroute Primary purpose Tests whether a host is reachable and measures round-trip latency Maps the sequence of routers (hops) a packet crosses to reach a host Underlying mechanism Sends an ICMP Echo Request and waits for an ICMP Echo Reply Sends probes with incrementing TTL, capturing an ICMP Time Exceeded from each hop TTL handling Uses a fixed, generous TTL (OS default, e.g. 64 or 128) meant to survive the whole path Deliberately starts TTL at 1 and increments it per probe to force expiry at each hop Who responds Only the final destination host replies Every intermediate router along the path replies, plus the destination Output produced Single or repeated RTT values and a packet loss percentage Ordered list of hop addresses with per-hop RTT samples Interpreting failure No reply means unreachable or blocked, without saying where A missing hop reply pinpoints exactly where the path breaks or gets filtered Typical runtime Fast, usually sub-second to a few seconds for a handful of probes Slower, since it waits on timeouts at each hop before moving to the next Common blocking issues Firewalls dropping ICMP Echo hide the host entirely, showing total silence Firewalls dropping Time Exceeded or Echo hide specific hops, shown as * * * Key Differences Ping only confirms reachability to the final host and reports nothing about the path in between. Traceroute exploits TTL expiry to make each router along the route reveal itself. A ping reply comes from the destination alone; traceroute yields one reply per hop. Traceroute is inherently slower since it waits on timeouts at every intermediate router, not just the endpoint. When ICMP is filtered, ping just times out, while traceroute pinpoints the exact blackhole hop. When to Use Each Ping ...

August 1, 2026 · 3 min · 459 words · jeonck

Static Routing vs Dynamic Routing: Manual Paths vs Self-Adapting Networks

Overview Static routing means an administrator manually enters every route into a router’s table, while dynamic routing lets routers automatically discover and adjust paths using a routing protocol. The choice comes down to a tradeoff between precise manual control and automatic adaptation to network changes. Comparison Diagram Static RoutingDynamic RoutingAdmin sets a fixed pathRouters exchange updatesABABCLink A-B failsLink A-B failsABTraffic still sent - blackholedABCAuto-reroutes via C Comparison Table Aspect Static Routing Dynamic Routing Configuration Manually entered by an administrator on each router Learned automatically through a routing protocol (OSPF, EIGRP, BGP, etc.) Path determination Fixed path defined once by the admin; never recalculated Computed algorithmically from real-time topology and link metrics Reaction to link/topology change No detection; route stays configured even if the path is down Protocol detects the failure and recalculates automatically Convergence time Instant to apply, but requires manual intervention to correct Seconds to minutes depending on protocol, then self-healing Resource overhead None - no CPU or bandwidth spent on updates Ongoing CPU for computation and bandwidth for update messages Scalability Impractical beyond a small, stable topology Scales to large, frequently changing networks Administrative control Exact, fully predictable path enforced by the admin Path chosen by the protocol based on metrics and policy, less predictable Key Differences Static routes are entered by hand; dynamic routes are learned via a routing protocol. Static routing has zero ongoing CPU and bandwidth cost; dynamic routing continuously spends both on updates. Only dynamic routing performs automatic failover when a link goes down. Static routing gives exact predictable paths; dynamic routing adapts them based on live metrics. Static doesn’t scale past a handful of routers; dynamic routing is required for large networks. When to Use Each Static Routing ...

August 1, 2026 · 3 min · 444 words · jeonck

OSI Model vs TCP/IP Model: 7 Conceptual Layers vs 4 Practical Layers

Overview The OSI Model is a conceptual seven-layer framework that ISO designed to standardize how network communication should be described, while the TCP/IP Model is the four-layer protocol suite that actually powers the internet. Real devices implement TCP/IP directly, but engineers still borrow OSI’s vocabulary to reason about and troubleshoot problems layer by layer. Comparison Diagram OSI ModelTCP/IP Model7. Application6. Presentation5. Session4. Transport3. Network2. Data Link1. PhysicalApplicationTransportInternetNetwork Access Comparison Table Aspect OSI Model TCP/IP Model Purpose Theoretical reference model for describing how network communication should work Practical protocol suite that actually runs the internet Layer count 7 layers 4 layers (sometimes taught as 5) Layer structure Application, Presentation, Session, Transport, Network, Data Link, Physical Application, Transport, Internet, Network Access Development origin Designed by ISO in the late 1970s/80s before matching protocols existed Grew out of DARPA’s ARPANET; protocols came first, the model was described afterward Protocol coupling Layers defined independently of any specific protocol Layers map directly onto real protocols like IP, TCP, and HTTP Encapsulation granularity Splits presentation and session concerns into their own distinct layers Folds presentation and session functions into the single Application layer Real-world adoption Rarely implemented exactly as specified; used mainly as a teaching and reference framework Implemented in essentially every networked device and across the internet Troubleshooting use Provides layer-by-layer vocabulary for isolating where a problem occurs Maps directly to the tools and protocols engineers actually configure and debug Key Differences OSI has seven layers while TCP/IP condenses the same concerns into four layers OSI is a theoretical reference model; TCP/IP is the actual protocol suite running the internet OSI separates Session and Presentation into distinct layers; TCP/IP merges them into one Application layer TCP/IP’s protocols were built first and the model described them afterward, while OSI’s layers were designed before implementation When to Use Each OSI Model ...

August 1, 2026 · 2 min · 415 words · jeonck

Unicast vs Multicast: One-to-One vs One-to-Many Delivery

Overview Unicast and multicast are IP transmission models that differ in how a sender’s data reaches its destinations. Unicast sends a dedicated copy to each individual recipient, while multicast sends a single stream that network devices replicate only where delivery paths actually diverge. The choice shapes bandwidth usage, routing complexity, and how receivers subscribe to traffic. Comparison Diagram UnicastMulticastSenderR1R2R33 separate packet copiessent end-to-endSenderR1R2R3single stream, replicatedonly at the branch point Comparison Table Aspect Unicast Multicast Addressing model One-to-one; packet is addressed to a single destination IP One-to-many; packet is addressed to a shared multicast group IP Sender behavior Sends a separate copy of the data for each recipient Sends one copy regardless of how many receivers exist Network replication No replication; each copy travels its own end-to-end path Routers/switches replicate the packet only at points where paths diverge Receiver participation Implicit; determined solely by the destination address Explicit; hosts must join the group (IGMP/MLD membership) Bandwidth scaling Grows linearly with the number of receivers Stays roughly constant on the sender’s link as receivers grow Routing requirements Standard unicast routing (OSPF, BGP, static routes) Requires multicast-aware routing (PIM-SM/DM plus IGMP) Delivery reliability Can run over TCP for guaranteed, ordered delivery Almost always UDP-based, with no built-in delivery guarantee Typical use cases Web browsing, file transfer, email, SSH Live video/audio streaming, market data feeds, routing protocol updates Key Differences Unicast requires a separate packet copy per receiver; multicast needs only one. Multicast pushes replication into the network fabric instead of the sender. Multicast receivers must explicitly join a group via IGMP before traffic arrives. Unicast bandwidth scales linearly with recipients; multicast stays flat. Multicast typically rides over UDP, sacrificing delivery guarantees for efficiency. When to Use Each Unicast ...

August 1, 2026 · 2 min · 390 words · jeonck

Subnet vs VLAN: Layer 3 IP Segmentation vs Layer 2 Port Segmentation

Overview A subnet and a VLAN both carve a large network into smaller, more manageable pieces, but they operate at different layers and are configured in different places. A subnet divides IP address space at Layer 3 based on address range and mask, independent of physical wiring, while a VLAN divides switch ports at Layer 2, creating separate broadcast domains on shared physical hardware. In most enterprise designs the two are paired one-to-one, but knowing which layer each governs matters for troubleshooting, security, and scaling. ...

August 1, 2026 · 3 min · 465 words · jeonck