This article explains how Go's runtime initializes, allocates, expands, and shrinks goroutine stack memory, detailing the underlying heap structures, global pools, platform‑specific constants, and the code paths that handle stack growth and reclamation.
This article explains how Go's sync.Cond works, demonstrates its usage with practical code examples, analyzes its internal implementation, and shows a real‑world application in Kubernetes FIFO queues, helping developers control goroutine synchronization effectively.
This article explains what Go channels are, how they are implemented in the runtime, their data structures, creation, sending, receiving, closing semantics, common pitfalls, and includes detailed code examples to illustrate channel behavior in concurrent programs.
Go achieves high concurrency by using its own M‑P‑G scheduling model, where lightweight goroutines (G) run on logical processors (P) that are mapped onto kernel threads (M), allowing user‑space scheduling that avoids the overhead of OS thread context switches.
This tutorial explains how to implement hot‑reloading of Go configuration files by manually sending Unix signals, covering the creation of a signal‑listening goroutine, use of the signal.Notify API, selective handling with select, and a complete example that loads JSON config on SIGUSR1.
The article walks through Go’s 1.9.2 scheduler on Linux, explaining how the three abstractions—G (goroutine), M (OS thread), and P (processor)—are created, bound, and used in the scheduling loop to run, yield, and balance goroutines via local, global, and stolen queues.
This article explores Go's goroutine implementation by dissecting the M‑P‑G model, scheduling strategies, preemption mechanisms, and low‑level context‑switch details, complemented with code snippets and assembly examples to illustrate how lightweight user‑level threads achieve high concurrency.
This article translates David Cheney's 2014 Gocon talk, detailing five Go language features—efficient value handling, inlining, escape analysis, goroutine scheduling, and dynamic stack management—that together explain Go's performance advantages, memory usage, and concurrency model.
The article investigates a Go 1.8.3 issue where goroutines block on ForkLock during fork‑exec, analyzes the kernel and Go runtime behavior, presents a hypothesis about memory‑heavy processes, validates it with experiments, and shows that upgrading to Go 1.9 or later eliminates the problem.
This article explains what a non‑reentrant function is, why it matters in concurrent Go programs, and demonstrates two practical implementations—using a sync.Mutex and an atomic flag—to ensure a function runs only once at any given time.
This article explains Go's channel feature, covering its design philosophy, channel types (bidirectional and directional), core operations such as send, receive, close, capacity queries, detailed execution rules for different channel states, and includes several illustrative code examples.
This article explains Go's channel primitive in depth, covering its conceptual model, types, operations, internal queues, rule scenarios, practical code examples, and best‑practice tips for building clear and efficient concurrent programs.
This article explains what goroutine leaks are, demonstrates how they occur in Alibaba's PouchContainer runtime, and provides practical detection methods and code‑level fixes using net/http/pprof, runtime.NumGoroutine, and CloseNotifier to keep Go services healthy.
This article explains the inner workings of Go's runtime scheduler, detailing how lightweight goroutines (G), logical processors (P), and OS threads (M) interact, how work stealing operates, and how to trace scheduler behavior using GODEBUG and go tool trace.
This article delves into Go's channel mechanism, explaining its three core signal properties—delivery guarantee, state, and data presence—while providing clear code examples for unbuffered, buffered, and context‑based channels to help developers write reliable concurrent programs.
This article explores the fundamentals of concurrency versus parallelism, the challenges of writing correct concurrent programs, the evolution from OS threads to green threads, Goroutine scheduling, actor‑model concepts, and modern strategies such as thread pools, async callbacks, and Rust's ownership model.