<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Runtime on Cheat Sheet</title><link>/tags/runtime/</link><description>Recent content in Runtime on Cheat Sheet</description><generator>Hugo</generator><language>en</language><atom:link href="/tags/runtime/index.xml" rel="self" type="application/rss+xml"/><item><title>Goroutines and the Go Runtime</title><link>/programming/go/concurrency/runtime/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/programming/go/concurrency/runtime/</guid><description>&lt;h1 id="goroutines-and-the-go-runtime"&gt;Goroutines and the Go Runtime&lt;a class="anchor" href="#goroutines-and-the-go-runtime"&gt;#&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;The Go runtime is far more than a standard library—it embeds garbage collection (GC), channel synchronization, memory management, and a &lt;strong&gt;user-space M:N scheduler&lt;/strong&gt; that multiplexes tens of thousands of lightweight goroutines onto a small pool of operating system threads.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="1-the-work-stealing-algorithm"&gt;1. The Work Stealing Algorithm&lt;a class="anchor" href="#1-the-work-stealing-algorithm"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Go concurrency follows a &lt;strong&gt;Fork-Join model&lt;/strong&gt;, where spawning a goroutine (&lt;code&gt;go func()&lt;/code&gt;) represents a &lt;strong&gt;Fork&lt;/strong&gt;, and waiting on a channel receive (&lt;code&gt;&amp;lt;-ch&lt;/code&gt;) or &lt;code&gt;sync.WaitGroup&lt;/code&gt; (&lt;code&gt;wg.Wait()&lt;/code&gt;) represents a &lt;strong&gt;Join&lt;/strong&gt;.&lt;/p&gt;</description></item></channel></rss>