<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Binary Dose</title>
    <description>The latest articles on DEV Community by Binary Dose (@binarydose).</description>
    <link>https://dev.to/binarydose</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4204496%2F51ff9ee5-7dac-46e9-95ec-c9eff53d3ed4.png</url>
      <title>DEV Community: Binary Dose</title>
      <link>https://dev.to/binarydose</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/binarydose"/>
    <language>en</language>
    <item>
      <title>How Relational Databases Prevent Data Corruption: Two-Phase Locking (2PL)</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Sun, 01 Nov 2026 18:37:37 +0000</pubDate>
      <link>https://dev.to/binarydose/how-relational-databases-prevent-data-corruption-two-phase-locking-2pl-5hc6</link>
      <guid>https://dev.to/binarydose/how-relational-databases-prevent-data-corruption-two-phase-locking-2pl-5hc6</guid>
      <description>&lt;h1&gt;
  
  
  How Relational Databases Prevent Data Corruption: Two-Phase Locking (2PL)
&lt;/h1&gt;

&lt;p&gt;When hundreds of database transactions read and write to the same tables concurrently, simply using locks is not enough.&lt;/p&gt;

&lt;p&gt;If transactions acquire and release locks haphazardly, the database can produce &lt;strong&gt;non-serializable anomalies&lt;/strong&gt;—such as reading partial updates, lost updates, or inconsistent snapshots.&lt;/p&gt;

&lt;p&gt;To mathematically guarantee &lt;strong&gt;Conflict Serializability&lt;/strong&gt;, relational database engines enforce &lt;strong&gt;Two-Phase Locking (2PL)&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ The Two Phases of 2PL
&lt;/h2&gt;

&lt;p&gt;A transaction must divide its lock operations into two distinct, non-overlapping phases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Locks Held
    ▲
    │             [ Lock Point ]
    │                  /\
    │                 /  \
    │   GROWING      /    \      SHRINKING
    │   PHASE       /      \     PHASE
    │  (Acquire)   /        \   (Release)
    │             /          \
    └────────────/────────────\─────────────► Time
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Growing Phase&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;The transaction may acquire new locks (Shared or Exclusive).&lt;/li&gt;
&lt;li&gt;The transaction &lt;strong&gt;CANNOT release any locks&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Lock Point&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;The exact moment the transaction acquires its final lock. The sequence of lock points across transactions dictates the global &lt;strong&gt;serialization order&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shrinking Phase&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;The transaction releases locks.&lt;/li&gt;
&lt;li&gt;The transaction &lt;strong&gt;CANNOT acquire any new locks&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  ⚠️ The Limitation of Basic 2PL: Cascading Aborts
&lt;/h2&gt;

&lt;p&gt;While basic 2PL guarantees serializability, it is vulnerable to &lt;strong&gt;Cascading Rollbacks&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;T1: write(A) ──&amp;gt; unlocks(A) [Shrinking Phase]
                      │
T2:                   └──&amp;gt; locks(A) ──&amp;gt; read(A) ──&amp;gt; write(B)
                                                          │
T1 crashes and ABORTS! ───────────────────────────────────┘
(T2 read dirty uncommitted data from T1, so T2 must also abort!)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Production Fix: Strict 2PL (S2PL)
&lt;/h3&gt;

&lt;p&gt;Modern RDBMS engines (like PostgreSQL and MySQL InnoDB) enforce &lt;strong&gt;Strict 2PL&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All &lt;strong&gt;Exclusive (write) locks&lt;/strong&gt; must be held until the transaction &lt;strong&gt;COMMITS or ABORTS&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This eliminates cascading aborts completely because uncommitted writes are never exposed to other transactions.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Explore Concurrency Schedules Interactively
&lt;/h2&gt;

&lt;p&gt;You can test custom schedules, generate precedence graphs, and detect deadlocks interactively on &lt;a href="https://binarydose.in/coredose/dbms/chapter-08/two-phase-locking-protocol-2pl" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>backend</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Why Servers Crash Under High Traffic: The TCP TIME_WAIT Trap</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Sun, 01 Nov 2026 11:17:23 +0000</pubDate>
      <link>https://dev.to/binarydose/why-servers-crash-under-high-traffic-the-tcp-timewait-trap-2f4h</link>
      <guid>https://dev.to/binarydose/why-servers-crash-under-high-traffic-the-tcp-timewait-trap-2f4h</guid>
      <description>&lt;h1&gt;
  
  
  Why Servers Crash Under High Traffic: The TCP TIME_WAIT Trap
&lt;/h1&gt;

&lt;p&gt;When a backend service or microservice opens thousands of outbound HTTP connections per second, CPU utilization might sit at 10%, yet the server suddenly crashes with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connect() failed (99: Cannot assign requested address)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The culprit is not a memory leak or a slow database query. It is the operating system's &lt;strong&gt;TCP TIME_WAIT state&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ The TCP 4-Way Teardown Flow
&lt;/h2&gt;

&lt;p&gt;When an endpoint initiates an active close:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client (Active Close)                 Server (Passive Close)
       │                                       │
       │─────── FIN (seq=100) ────────────────&amp;gt;│ (CLOSE_WAIT)
       │&amp;lt;────── ACK (ack=101) ─────────────────│
       │                                       │
       │&amp;lt;────── FIN (seq=300) ─────────────────│ (LAST_ACK)
       │─────── ACK (ack=301) ────────────────&amp;gt;│ (CLOSED)
       │
  [TIME_WAIT] ⏳ (Holds socket for 2 × MSL: ~60–120s)
       │
    (CLOSED)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The host that sends the final ACK does NOT immediately close the socket. It enters &lt;code&gt;TIME_WAIT&lt;/code&gt; and holds the &lt;code&gt;(Source IP, Source Port, Dest IP, Dest Port)&lt;/code&gt; tuple in the kernel socket table for &lt;strong&gt;2 × MSL&lt;/strong&gt; (Maximum Segment Lifetime).&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Why Does TIME_WAIT Exist?
&lt;/h2&gt;

&lt;p&gt;It serves two fundamental protocol guarantees:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clean Final ACK Delivery&lt;/strong&gt;: If the client's final ACK drops on the wire, the server retransmits its &lt;code&gt;FIN&lt;/code&gt;. If the client closed instantly, it would reply with an &lt;code&gt;RST&lt;/code&gt; (connection reset error) instead of completing an orderly shutdown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ghost Packet Draining&lt;/strong&gt;: Old TCP segments delayed in slow router buffers could arrive minutes later. If the OS reassigned that identical &lt;code&gt;IP:Port&lt;/code&gt; pair immediately, ghost packets from the previous session would corrupt the new data stream!&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🛠️ The Ephemeral Port Exhaustion Trap
&lt;/h2&gt;

&lt;p&gt;Linux provides a limited pool of ephemeral outbound ports (typically ~28,000 ports between &lt;code&gt;32768&lt;/code&gt; and &lt;code&gt;60999&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If your microservice opens 500 connections/sec without connection reuse:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sockets in TIME\_WAIT = 500 × 60 seconds = 30,000 sockets!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All local outbound ports are exhausted!&lt;/p&gt;

&lt;h3&gt;
  
  
  The Production Fix:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enable HTTP Keep-Alive&lt;/strong&gt;: Reuse persistent connections via connection pooling (HTTP clients like Axios, Go's &lt;code&gt;http.Transport&lt;/code&gt;, or Python &lt;code&gt;requests.Session&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tune Linux Socket Reuse&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  sysctl &lt;span class="nt"&gt;-w&lt;/span&gt; net.ipv4.tcp_tw_reuse&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 Trace the Full TCP State Machine Interactively
&lt;/h2&gt;

&lt;p&gt;You can test state transitions, inject lost packets, and simulate the 2MSL timer interactively on &lt;a href="https://binarydose.in/coredose/cn/module-06/tcp-state-machine-and-time-wait-socket-mechanics" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Announcing the Compiler Design Master Track: From Lexical Scanners to Machine Code</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Sun, 01 Nov 2026 04:07:12 +0000</pubDate>
      <link>https://dev.to/binarydose/announcing-the-compiler-design-master-track-from-lexical-scanners-to-machine-code-216n</link>
      <guid>https://dev.to/binarydose/announcing-the-compiler-design-master-track-from-lexical-scanners-to-machine-code-216n</guid>
      <description>&lt;h1&gt;
  
  
  🚀 CoreDose Launch: Compiler Design (CD) Master Track
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;"Our goal is to provide the absolute best learning experience to our students so they grasp mental models in under 3 seconds."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We are thrilled to announce that the complete &lt;strong&gt;Compiler Design (CD)&lt;/strong&gt; curriculum is now &lt;strong&gt;LIVE and 100% free&lt;/strong&gt; on &lt;a href="https://binarydose.in/coredose/compiler" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Compilers are often considered the "black magic" of software engineering. This track pulls back the curtain to reveal how human code transforms into raw machine execution.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ The 8-Phase Compiler Pipeline
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Source Code
    │
    ▼ [1. Lexical Analyzer]       ──► Tokens (Lexemes)
    │
    ▼ [2. Syntax Analyzer]        ──► Abstract Syntax Tree (AST)
    │
    ▼ [3. Semantic Analyzer]      ──► Decorated AST (Type-Checked)
    │
    ▼ [4. Intermediate Generator] ──► Three-Address Code (TAC)
    │
    ▼ [5. Target Code Optimizer]  ──► Optimized Control Flow Graphs
    │
    ▼ [6. Target Code Generator]  ──► Physical Machine Instructions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📚 The 8-Module Curriculum Overview
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Phase 1: Frontend &amp;amp; Lexical Processing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Module 01&lt;/strong&gt;: Language Processing System (Preprocessor, Compiler, Assembler, Linker, Loader), Analysis vs Synthesis, and Symbol Table Management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Module 02&lt;/strong&gt;: Lexical Analysis, Tokens, Patterns, Lexemes, Two-Buffer Input Buffering with Sentinels, and Lex/Flex specifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Phase 2: Syntax Analysis &amp;amp; Parsing Hierarchy
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Module 03&lt;/strong&gt;: Context-Free Grammars, Derivations, Parse Trees, Ambiguity Elimination, and Left-Recursion Removal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Module 04&lt;/strong&gt;: Top-Down Predictive Parsing, FIRST and FOLLOW Mathematical Sets, and LL(1) Table Construction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Module 05&lt;/strong&gt;: Bottom-Up Parsing Hierarchy: Shift-Reduce, LR(0) Canonical Collections, SLR(1), CLR(1), and LALR(1) Lookahead Item Merging.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Phase 3: Semantic Analysis &amp;amp; Backend Optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Module 06&lt;/strong&gt;: Syntax-Directed Definitions (SDD) vs Translation (SDT), S-Attributed vs L-Attributed evaluation orders, and Type Checking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Module 07&lt;/strong&gt;: Intermediate Code Generation: Three-Address Code (TAC), Quadruples, Triples, Syntax Trees, DAGs, and Backpatching.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Module 08&lt;/strong&gt;: Code Optimization &amp;amp; Runtime Environments: Basic Blocks, Control Flow Graphs (CFG), Loop Invariant Code Motion, Dead Code Elimination, Activation Records, and Peephole Optimization.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 Why Binary Dose?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Visual State &amp;amp; Parsing Tables&lt;/strong&gt;: Trace predictive parsing tables and LR canonical collections without messy pen-and-paper guesswork.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First Principles Math&lt;/strong&gt;: FIRST &amp;amp; FOLLOW sets and ambiguity elimination broken down step by step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Paywalls&lt;/strong&gt;: Always 100% open-access engineering education.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Explore the complete curriculum right now:&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://binarydose.in/coredose/compiler" rel="noopener noreferrer"&gt;https://binarydose.in/coredose/compiler&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Why Systems Freeze Forever: The 4 Deadlock Conditions Explained with Code</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Sat, 31 Oct 2026 17:57:35 +0000</pubDate>
      <link>https://dev.to/binarydose/why-systems-freeze-forever-the-4-deadlock-conditions-explained-with-code-2doh</link>
      <guid>https://dev.to/binarydose/why-systems-freeze-forever-the-4-deadlock-conditions-explained-with-code-2doh</guid>
      <description>&lt;h1&gt;
  
  
  Why Systems Freeze Forever: The 4 Deadlock Conditions Explained with Code
&lt;/h1&gt;

&lt;p&gt;A &lt;strong&gt;deadlock&lt;/strong&gt; is not slow code or an infinite loop. It is an eternal system freeze where two or more threads sleep forever, each holding a lock the other needs.&lt;/p&gt;

&lt;p&gt;In 1971, computer scientist Edward G. Coffman Jr. proved that a deadlock is mathematically impossible unless &lt;strong&gt;4 hardware conditions hold simultaneously&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ The 4 Coffman Conditions
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Thread 1 holds [Lock A] ──waits for──&amp;gt; [Lock B]
     ▲                                       │
     │                                       ▼
[Lock A] &amp;lt;──waits for── Thread 2 holds [Lock B]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Mutual Exclusion&lt;/strong&gt;: Resources are non-shareable. Only one thread can hold an exclusive mutex or write lock at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hold and Wait&lt;/strong&gt;: A thread holding Resource A is permitted to block while waiting to acquire Resource B.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Preemption&lt;/strong&gt;: The operating system kernel cannot forcibly seize an allocated lock. It must be released voluntarily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Circular Wait&lt;/strong&gt;: A closed dependency loop exists where Thread 1 waits for Thread 2, and Thread 2 waits for Thread 1.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💻 The Classic Deadlock Trap in C
&lt;/h2&gt;

&lt;p&gt;Here is the quintessential anti-pattern that freezes production services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Thread 1&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;thread_one&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Simulating work...&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Stalls waiting for Thread 2!&lt;/span&gt;

    &lt;span class="c1"&gt;// Critical Section&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Thread 2&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;thread_two&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Stalls waiting for Thread 1!&lt;/span&gt;

    &lt;span class="c1"&gt;// Critical Section&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🛠️ The Mathematical Law of Prevention
&lt;/h2&gt;

&lt;p&gt;Because all 4 conditions must hold simultaneously for a deadlock to exist:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you break even ONE condition, deadlock becomes mathematically impossible!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The most practical production strategy is breaking &lt;strong&gt;Circular Wait&lt;/strong&gt; via &lt;strong&gt;Strict Lock Hierarchy Ordering&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Enforce global acquisition order: Always Lock A before Lock B!&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;safe_worker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// Safe: Circular wait can never form!&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;pthread_mutex_unlock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;lock_A&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 Test and Visualize Deadlocks Interactively
&lt;/h2&gt;

&lt;p&gt;Static diagrams only tell half the story. You can build Resource Allocation Graphs (RAG) and simulate cycle detection algorithms interactively on &lt;a href="https://binarydose.in/coredose/os/chapter-05/deadlock-characterization-the-4-necessary-coffman-conditions" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>operatingsystems</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Error Detection: Parity, Checksum &amp; Cyclic Redundancy Check (CRC)</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Sat, 31 Oct 2026 13:17:48 +0000</pubDate>
      <link>https://dev.to/binarydose/error-detection-parity-checksum-cyclic-redundancy-check-crc-ofo</link>
      <guid>https://dev.to/binarydose/error-detection-parity-checksum-cyclic-redundancy-check-crc-ofo</guid>
      <description>&lt;h1&gt;
  
  
  Error Detection: Parity, Checksum &amp;amp; Cyclic Redundancy Check (CRC)
&lt;/h1&gt;

&lt;p&gt;When raw electrical voltage pulses or radio waves travel across cables and air, electromagnetic interference inevitably corrupts bits in flight.&lt;/p&gt;

&lt;p&gt;To prevent silent data corruption, network protocols append redundant error-detecting bits to every frame. Among all techniques, &lt;strong&gt;Cyclic Redundancy Check (CRC)&lt;/strong&gt; is the undisputed champion of the Data Link layer.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ Why Parity and Checksums Fail
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technique&lt;/th&gt;
&lt;th&gt;Where Used&lt;/th&gt;
&lt;th&gt;Detection Strength&lt;/th&gt;
&lt;th&gt;Fatal Blind Spot&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Simple Parity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Serial UART, RAM&lt;/td&gt;
&lt;td&gt;All single-bit errors&lt;/td&gt;
&lt;td&gt;Blind to any &lt;strong&gt;even number of bit flips&lt;/strong&gt; (&lt;code&gt;2, 4, 6&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Internet Checksum&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;IPv4, TCP headers&lt;/td&gt;
&lt;td&gt;Good general software checksum&lt;/td&gt;
&lt;td&gt;Blind to &lt;strong&gt;byte swaps&lt;/strong&gt; and equal opposing errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cyclic Redundancy Check (CRC)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ethernet, Wi-Fi, 4G/5G, SATA&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Near 100% of all error patterns&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requires hardware shift registers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 The Mathematics of CRC
&lt;/h2&gt;

&lt;p&gt;CRC treats binary bit strings as algebraic polynomials over the Galois field &lt;code&gt;GF(2)&lt;/code&gt;, where &lt;strong&gt;addition and subtraction are identical to bitwise XOR (&lt;code&gt;oplus&lt;/code&gt;) with no carries and no borrows&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;beginaligned 1 oplus 1 &amp;amp;= 0 \\ 1 oplus 0 &amp;amp;= 1 \\ 0 oplus 1 &amp;amp;= 1 \\ 0 oplus 0 &amp;amp;= 0 endaligned
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The 4-Step CRC Algorithm
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Let the original data be &lt;code&gt;D&lt;/code&gt; (&lt;code&gt;k&lt;/code&gt; bits) and the agreed Generator Polynomial be &lt;code&gt;G&lt;/code&gt; of degree &lt;code&gt;r&lt;/code&gt; (&lt;code&gt;r + 1&lt;/code&gt; bits).&lt;/li&gt;
&lt;li&gt;Append &lt;code&gt;r&lt;/code&gt; zero bits to the end of &lt;code&gt;D&lt;/code&gt;, yielding &lt;code&gt;D · 2^r&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Divide &lt;code&gt;D · 2^r&lt;/code&gt; by &lt;code&gt;G&lt;/code&gt; using modulo-2 XOR long division.&lt;/li&gt;
&lt;li&gt;The remainder &lt;code&gt;R&lt;/code&gt; (&lt;code&gt;r&lt;/code&gt; bits) is the &lt;strong&gt;Frame Check Sequence (FCS)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The transmitted frame is &lt;code&gt;T = (D · 2^r) oplus R&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;At the Receiver:
                Received Frame (T)
                ──────────────────  =  Remainder ?
                  Generator (G)

  • If Remainder == 0: Frame is intact and accepted!
  • If Remainder != 0: Frame suffered bit corruption -&amp;gt; Discard immediately!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In standard IEEE 802.3 Ethernet, &lt;strong&gt;CRC-32&lt;/strong&gt; uses a 33-bit generator polynomial that catches &lt;strong&gt;100% of burst errors up to 32 consecutive bits long&lt;/strong&gt;, keeping our global internet packets bit-for-bit clean!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Solve step-by-step CRC polynomial divisions with our interactive calculator on &lt;a href="https://binarydose.in/coredose/cn/module-02/error-detection-parity-checksum-and-crc" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Round Robin Scheduling: The 80% Time Quantum Heuristic</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Thu, 29 Oct 2026 19:16:06 +0000</pubDate>
      <link>https://dev.to/binarydose/round-robin-scheduling-the-80-time-quantum-heuristic-nh0</link>
      <guid>https://dev.to/binarydose/round-robin-scheduling-the-80-time-quantum-heuristic-nh0</guid>
      <description>&lt;h1&gt;
  
  
  Round Robin CPU Scheduling
&lt;/h1&gt;

&lt;p&gt;How do modern kernels balance high throughput with instant interactive UI responsiveness?&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ Context Switching Overhead
&lt;/h2&gt;

&lt;p&gt;Every preemptive switch requires:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Saving CPU registers into the PCB.&lt;/li&gt;
&lt;li&gt;Reloading kernel register state.&lt;/li&gt;
&lt;li&gt;Invaliding TLB caches on process boundary switch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the slice is too narrow, overhead dominates execution time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Explore the CPU Gantt chart simulator on &lt;a href="https://binarydose.in/coredose/os/chapter-03/round-robin-scheduling-and-time-quantum-trade-offs" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>linux</category>
      <category>operatingsystems</category>
      <category>computerscience</category>
      <category>performance</category>
    </item>
    <item>
      <title>The Two Pointers Pattern: Turning O(N ) into O(N)</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Thu, 29 Oct 2026 10:55:26 +0000</pubDate>
      <link>https://dev.to/binarydose/the-two-pointers-pattern-turning-on2-into-on-g7a</link>
      <guid>https://dev.to/binarydose/the-two-pointers-pattern-turning-on2-into-on-g7a</guid>
      <description>&lt;h1&gt;
  
  
  The Two Pointers Pattern
&lt;/h1&gt;

&lt;p&gt;The Two Pointers technique is one of the most fundamental algorithmic patterns in technical coding interviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ The Monotonic Invariant
&lt;/h2&gt;

&lt;p&gt;In a sorted array, &lt;code&gt;arr[i] &amp;lt;= arr[j]&lt;/code&gt; for all &lt;code&gt;i &amp;lt; j&lt;/code&gt;. By comparing opposite ends, we prune an entire search space with every pointer step.&lt;/p&gt;

&lt;p&gt;Total operations: &lt;code&gt;N&lt;/code&gt; steps &lt;code&gt;→ O(N)&lt;/code&gt; time, &lt;code&gt;O(1)&lt;/code&gt; auxiliary space.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Watch the interactive step-by-step visualizer with live variables on &lt;a href="https://binarydose.in/algodose" rel="noopener noreferrer"&gt;AlgoDose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>dsa</category>
      <category>coding</category>
      <category>interview</category>
    </item>
    <item>
      <title>The Bounded Buffer Problem: Why Mutex Locks Aren't Enough</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Wed, 28 Oct 2026 19:08:59 +0000</pubDate>
      <link>https://dev.to/binarydose/the-bounded-buffer-problem-why-mutex-locks-arent-enough-1ng4</link>
      <guid>https://dev.to/binarydose/the-bounded-buffer-problem-why-mutex-locks-arent-enough-1ng4</guid>
      <description>&lt;h1&gt;
  
  
  The Producer-Consumer Problem
&lt;/h1&gt;

&lt;p&gt;In concurrent systems, multiple threads produce and consume data through a fixed-size shared buffer.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ The 3 Semaphore Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;mutex = 1&lt;/code&gt;: Protects critical section.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;empty = N&lt;/code&gt;: Blocks producer when buffer is full.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;full = 0&lt;/code&gt;: Blocks consumer when buffer is empty.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Explore the interactive step-by-step buffer visualizer on &lt;a href="https://binarydose.in/coredose/os/chapter-04/classical-synchronization-problems-producer-consumer-bounded-buffer" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>concurrency</category>
      <category>c</category>
      <category>operatingsystems</category>
      <category>programming</category>
    </item>
    <item>
      <title>TCP SYN Floods: Why Servers Need Stateless SYN Cookies</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Wed, 28 Oct 2026 10:36:46 +0000</pubDate>
      <link>https://dev.to/binarydose/tcp-syn-floods-why-servers-need-stateless-syn-cookies-11gb</link>
      <guid>https://dev.to/binarydose/tcp-syn-floods-why-servers-need-stateless-syn-cookies-11gb</guid>
      <description>&lt;h1&gt;
  
  
  TCP SYN Floods &amp;amp; SYN Cookies
&lt;/h1&gt;

&lt;p&gt;The classic TCP 3-Way Handshake has an inherent asymmetry that attackers exploit for denial-of-service.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ The Half-Open Vulnerability
&lt;/h2&gt;

&lt;p&gt;Every incoming SYN allocates a socket structure in the kernel's SYN queue. If ACKs never arrive, the queue fills and all new connections drop.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛡️ The Cryptographic Fix: SYN Cookies
&lt;/h2&gt;

&lt;p&gt;By setting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ISN = Hash(s_ip, d_ip, s_port, d_port, counter) + MSS index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the server remains completely stateless until the client sends the final ACK!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Explore the space-time protocol ladder on &lt;a href="https://binarydose.in/100-days/day-01-tcp-3-way-handshake" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>security</category>
      <category>networking</category>
      <category>linux</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How the fork() System Call Actually Works in Linux</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Tue, 27 Oct 2026 19:10:26 +0000</pubDate>
      <link>https://dev.to/binarydose/how-the-fork-system-call-actually-works-in-linux-2d4a</link>
      <guid>https://dev.to/binarydose/how-the-fork-system-call-actually-works-in-linux-2d4a</guid>
      <description>&lt;h1&gt;
  
  
  The fork() System Call
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;pid_t&lt;/span&gt; &lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fork&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I am the child!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I am the parent of %d!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚡ Copy-on-Write (COW)
&lt;/h2&gt;

&lt;p&gt;Rather than copying gigabytes of RAM during &lt;code&gt;fork()&lt;/code&gt;, the kernel marks all page table entries as read-only. A page is physically cloned only when one process attempts to write to it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Explore the full interactive process lifecycle on &lt;a href="https://binarydose.in/coredose/os/chapter-06/the-fork-system-call-duplication-memory-copy-and-return-codes" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>linux</category>
      <category>c</category>
      <category>operatingsystems</category>
      <category>programming</category>
    </item>
    <item>
      <title>Write-Ahead Logging: How PostgreSQL &amp; MySQL Survive Power Loss</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Tue, 27 Oct 2026 09:50:24 +0000</pubDate>
      <link>https://dev.to/binarydose/write-ahead-logging-how-postgresql-mysql-survive-power-loss-4lkp</link>
      <guid>https://dev.to/binarydose/write-ahead-logging-how-postgresql-mysql-survive-power-loss-4lkp</guid>
      <description>&lt;h1&gt;
  
  
  Write-Ahead Logging (WAL) &amp;amp; ARIES Recovery
&lt;/h1&gt;

&lt;p&gt;How do databases guarantee ACID Durability without grinding write throughput to a halt?&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ The WAL Protocol
&lt;/h2&gt;

&lt;p&gt;Before any data page in shared buffers can be flushed to table storage, the corresponding log record must already exist on non-volatile disk.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ The ARIES Phase Trio
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Analysis Phase&lt;/strong&gt;: Reconstructs dirty page tables from last checkpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redo Phase&lt;/strong&gt;: Repeats history to recover state at the moment of crash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Undo Phase&lt;/strong&gt;: Rolls back operations of all uncommitted transactions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Read the complete storage engine lesson on &lt;a href="https://binarydose.in/100-days/day-11-write-ahead-logging-wal" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>backend</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Python's Integer Interning Trap: Why 'is' Lies Above 256</title>
      <dc:creator>Binary Dose</dc:creator>
      <pubDate>Mon, 26 Oct 2026 19:36:46 +0000</pubDate>
      <link>https://dev.to/binarydose/pythons-integer-interning-trap-why-is-lies-above-256-5ack</link>
      <guid>https://dev.to/binarydose/pythons-integer-interning-trap-why-is-lies-above-256-5ack</guid>
      <description>&lt;h1&gt;
  
  
  Python's Integer Interning Trap
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;256&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;256&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# True
&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;257&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;257&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# False (in REPL!)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚡ The Small Integer Cache
&lt;/h2&gt;

&lt;p&gt;CPython allocates a fixed table of integer objects spanning &lt;code&gt;[-5, 256]&lt;/code&gt; during interpreter initialization.&lt;/p&gt;

&lt;p&gt;Because integers are immutable, caching frequently used numbers saves massive memory overhead.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Read the full breakdown on &lt;a href="https://binarydose.in" rel="noopener noreferrer"&gt;Binary Dose&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>softwareengineering</category>
      <category>interview</category>
    </item>
  </channel>
</rss>
