tinycodinglm / lang /lang-0019.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
826 Bytes
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

Explain Go's concurrency model

Assistant

Goroutines: lightweight threads, stack 2-8KB, grow dynamically. M:N scheduler maps goroutines to OS threads via G-M-P model.

Channels: typed conduits. make(chan int) unbuffered, make(chan int, 10) buffered. Send ch<-recv <-ch, close(ch) signals end.

Select: multiplex channel operations. Case/default for non-blocking.

Patterns: fan-out/fan-in, pipeline, done channel, worker pool. sync.Mutex, sync.WaitGroup, sync.Once, sync.Pool for shared state.