In recent years, more and more programming languages are introducing green threads internally, a type of concurrency that is built by abstracting native OS threads using the language’s runtime.
They may have various names, but the concept is always almost the same: coroutines, virtual threads (Java 1.19+), goroutines (Go), fibers (PHP), etc.
But… Why? As we will see, they are great for I/O bound tasks, and we will analyze the logic behind Go’s implementation, which is one of the most mature.