Goroutines are lightweight, user-space threads managed by the Go runtime, while threads are heavier, OS-managed execution units. Goroutines are more efficient because the Go runtime multiplexes thousands of them onto a smaller number of OS threads, whereas threads are created and scheduled directly by the operating system.
// Goroutine: Lightweight, managed by Go runtime
func worker() { /* ... */ }
// Start a goroutine (costs ~2KB stack initially)
go worker()
// Thread: Heavyweight, managed by OS (via cgo/pthreads)
// Requires explicit binding to an OS thread
runtime.LockOSThread()
// Now this goroutine runs on a dedicated OS thread