<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pdeshpande on Medium]]></title>
        <description><![CDATA[Stories by Pdeshpande on Medium]]></description>
        <link>https://medium.com/@pdeshpande666?source=rss-58d2abd19dfa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YjM_6ayw_ePP_Uzo</url>
            <title>Stories by Pdeshpande on Medium</title>
            <link>https://medium.com/@pdeshpande666?source=rss-58d2abd19dfa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 15:10:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pdeshpande666/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Why Go Needs a Runtime — Even After Compilation” ]]></title>
            <link>https://medium.com/@pdeshpande666/why-go-needs-a-runtime-even-after-compilation-503aaa5c4f1f?source=rss-58d2abd19dfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/503aaa5c4f1f</guid>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Pdeshpande]]></dc:creator>
            <pubDate>Mon, 01 Dec 2025 20:55:58 GMT</pubDate>
            <atom:updated>2025-12-01T20:55:58.358Z</atom:updated>
            <content:encoded><![CDATA[<h3>“Why Go Needs a Runtime — Even After Compilation” 🤔</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uOABDsBJWoYiihZhIOpSRQ.png" /></figure><p>When you hit <strong><em>go run</em></strong> or <strong><em>go build</em></strong>, two helpers kick in: the <strong>Compiler</strong> and the <strong>Runtime</strong>. They may sound similar because both are involved in running your program, but they serve very different purposes.</p><p>To understand how Go code truly executes, let’s break it down with simple analogies.</p><h3><strong>🧠 The Go Compiler — Your Personal Translator</strong></h3><p>Think of the compiler as a translator in a room full of people who speak different languages.</p><ul><li>You (the developer) speak <strong>Go</strong> — high-level, human-readable instructions.</li><li>The compiler translates that into <strong>machine code</strong> (binary instructions) that the CPU understands.</li><li>The result is a platform-specific executable (x86, ARM, etc.).</li></ul><p>In short :</p><blockquote><strong><em>The compiler </em>prepares<em> your program for the computer.</em></strong></blockquote><p>Without this translation, your laptop or server would stare blankly at your beautifully written Go code — it simply can’t understand it.</p><h3><strong>⚙️ The Go Runtime — The Engine Running the Show</strong></h3><p>Once your program is compiled, the <strong>runtime</strong> steps in.<br> If the compiler is the translator, the <strong>runtime is the engine, conductor, and janitor — all at once.</strong></p><p>The Go runtime manages these essential tasks:</p><h4>1. ♻️Garbage Collection (The Janitor)</h4><p>Cleans up memory your program no longer needs, so you don’t have to hunt down every forgotten allocation.</p><p>No more manual malloc() and free() like in C — the runtime handles it safely and automatically.</p><h4>2. 🔁Goroutine Scheduling (The Conductor)</h4><p>Imagine traffic at a busy intersection.</p><p>The Go runtime decides:</p><ul><li>which goroutine runs,</li><li>when it runs,</li><li>and on which CPU core.</li></ul><p>You simply write go myFunction(), and the runtime orchestrates the rest.</p><h4>3. 🪛Runtime Libraries (The Toolkit)</h4><p>Features like:</p><ul><li>Channels</li><li>Reflection</li><li>Timers</li><li>Panic/Recover handling</li><li>stack management</li></ul><p>These aren’t “just code” — they rely on runtime machinery underneath.</p><h3>🐧If Go Compiles to Machine Code, Why Do We Need the Runtime?</h3><p>Great question!</p><p>Even though Go produces machine code like C or C++, it adds much <strong>more intelligence</strong> on top.</p><h4>❓Why Go still needs a runtime:</h4><ul><li>Modern CPUs have multiple cores → we need an efficient scheduler.</li><li>Safe and high-performance concurrency is hard to do manually.</li><li>Manual memory management (like in C/C++) is error-prone.</li><li>Features like goroutines, channels, timers, and reflection can’t be done using “just machine code.”</li></ul><p>A car engine can run the vehicle — <br> but you still need the transmission, sensors, brakes, and safety systems to make it usable.</p><p>The runtime is Go’s built-in “automatic driving system.”</p><h3>🎯 Why Understanding This Matters</h3><p>Understanding compiler vs runtime helps you:</p><ul><li>Reason about performance (what the compiler does vs what the runtime manages).</li><li>Debug memory or concurrency issues (knowing where GC and the scheduler intervene).</li><li>Answer interview questions succinctly: “Go compiles to machine code, but needs a runtime for GC, goroutine scheduling, and runtime libraries.”</li></ul><h3>🧩 <strong>A Simple Summary to Remember</strong></h3><blockquote><strong>Compiler<em> </em></strong>— Turns your code into machine instructions.<br><strong>Runtime<em> </em></strong>— Makes those instructions run safely, efficiently, and concurrently.</blockquote><h3>💬 Conclusion</h3><p>Understanding the balance between what the compiler does and what the runtime manages is key to mastering Go beyond just its syntax.</p><p>The more you explore Go’s runtime, the more you appreciate how much heavy lifting it does behind the scenes. It’s like discovering the hidden machinery that keeps everything running smoothly.</p><p>If you plan to dive deeper into Go system design, concurrency patterns, or performance tuning, this foundation will take you a long way — and if you enjoyed this topic and want more deep-dives into Go internals, concurrency, or runtime behavior, feel free to follow along!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=503aaa5c4f1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>