3 ms·
> 1. Goroutines are not threads They are not kernel-level threads, but they are threads in every other meaningful sense; they have their own stack and executio
by lobster_johnson 14y ago
> 1. Goroutines are not threads
They are not kernel-level threads, but they are threads in every other meaningful sense; they have their own stack and execution pointer, and data operations in goroutines are not guaranteed to be atomic with respect to other goroutines.
While the current official Go implementation never preemptively schedules goroutines except on I/O and on runtime.Gosched(), nothing in the spec precludes a different, more kernel-thread-like scheduling system.
- justinhj 14y agoUsing the term thread interchangeably with goroutine causes confusion, otherwise why bother having a different name for them in the first place?
- danieldk 14y agoBecause there already exists a perfectly fine name for them: green threads (as opposed to operating system threads), using M:N threading. http://en.wikipedia.org/wiki/Green_threads http://en.wikipedia.org/wiki/Green_threads http://en.wikipedia.org/wiki/Thread_(computing)#M:N_.28Hybrid_threading.29 http://en.wikipedia.org/wiki/Thread_(computing)#M:N_.28Hybri... They are just a subclass of threads.