Understanding Go Routines

Published: 7/10/2025

Understanding Go Routines

Go routines are a lightweight thread of execution. They are not OS threads, but rather functions that run concurrently with other functions or methods.

Key Characteristics:

Example:

package main

import (
	"fmt"
	"time"
)

func sayHello() {
	fmt.Println("Hello from a goroutine!")
}

func main() {
	go sayHello()
	fmt.Println("Hello from main!")
	time.Sleep(1 * time.Second) // Give the goroutine time to execute
}

This simple example demonstrates how to launch a Go routine using the go keyword. The main function will continue its execution concurrently with sayHello.

goconcurrencygoroutines
← Back to Blog