Greenthread
Noun · Development
Definitions
A lightweight thread managed by the runtime or a library rather than the operating system, enabling high concurrency with low overhead. Green threads in Go are goroutines; in Java 21, they're virtual threads.
In plain English: A lightweight thread managed by the programming language itself rather than the operating system, letting you run thousands of tasks at once without the overhead of real threads.
Go's goroutines are the most successful greenthread implementation: they start with a 2KB stack (vs. 1MB for OS threads), grow dynamically, and are multiplexed across OS threads by the Go runtime. This enables millions of concurrent goroutines on a single machine.
Example: 'We spawn a goroutine per WebSocket connection. With 500,000 concurrent connections, that's 500,000 greenthreads using about 1GB of memory. OS threads would need 500GB.'
Source: goroutine implementation