<?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>/kr/tags/runtime/</link><description>Recent content in Runtime on Cheat Sheet</description><generator>Hugo</generator><language>kr</language><atom:link href="/kr/tags/runtime/index.xml" rel="self" type="application/rss+xml"/><item><title>Goroutines and the Go Runtime</title><link>/kr/programming/go/concurrency/runtime/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/kr/programming/go/concurrency/runtime/</guid><description>&lt;h1 id="고루틴과-go-런타임-goroutines-and-the-go-runtime"&gt;고루틴과 Go 런타임 (Goroutines and the Go Runtime)&lt;a class="anchor" href="#%ea%b3%a0%eb%a3%a8%ed%8b%b4%ea%b3%bc-go-%eb%9f%b0%ed%83%80%ec%9e%84-goroutines-and-the-go-runtime"&gt;#&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Go의 런타임(Runtime)은 단순한 라이브러리가 아니라, 가비지 컬렉션(GC), 채널 통신, 메모리 할당, 그리고 수만 개의 고루틴을 소수의 운영체제 스레드(OS Thread) 위에 다중화(Multiplexing)하는 &lt;strong&gt;유저 레벨 스케줄러&lt;/strong&gt;(User-Space Scheduler)를 내장하고 있다.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="1-작업-훔치기-알고리즘-work-stealing-algorithm"&gt;1. 작업 훔치기 알고리즘 (Work Stealing Algorithm)&lt;a class="anchor" href="#1-%ec%9e%91%ec%97%85-%ed%9b%94%ec%b9%98%ea%b8%b0-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-work-stealing-algorithm"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Go의 동시성 프로그램은 고루틴을 생성하는 &lt;strong&gt;Fork(&lt;code&gt;go func()&lt;/code&gt;)&lt;/strong&gt;와 채널 수신이나 &lt;code&gt;sync.WaitGroup&lt;/code&gt;으로 결과를 합치는 &lt;strong&gt;Join(&lt;code&gt;&amp;lt;-ch&lt;/code&gt;, &lt;code&gt;wg.Wait()&lt;/code&gt;)&lt;/strong&gt;이 반복되는 &lt;strong&gt;Fork-Join 모델&lt;/strong&gt;을 따른다.&lt;/p&gt;
&lt;p&gt;멀티코어 환경에서 모든 프로세서에 작업을 고르게 분산하기 위해 Go 스케줄러는 &lt;strong&gt;작업 훔치기(Work Stealing)&lt;/strong&gt; 알고리즘을 사용한다.&lt;/p&gt;</description></item></channel></rss>