In concurrent programming, a green thread is a type of thread that is scheduled by the language’s runtime library or virtual machine instead of relying on the underlying operating system. This allows the language to emulate a multithreaded environment in user space instead of kernel space (which also allows it to work on platforms with differing/no thread support).

Green threads are supported natively in Go and in Java.

Language-specific

Go makes heavy uses of green threads as goroutines. They can be spawned basically at will: there’s no need to annotate a function as async or have special returns. They’re ordinary functions that will be scheduled by the runtime library.

go func() {
 
}() // spawning a closure-based goroutine