Jargon: What is thread in programing language (2026)

By Xah Lee. Date: .

threads / concurrency, is a very complicated thing.

and js event loop is the worst faak.

by the way, thread is advanced. for most programers, u never need it.

best is true parallel computation in lang design. typically the c cpp types have no clue.

explain what is a thread in computing

(ai answer)

A thread is the smallest unit of execution that an operating system can schedule and run. It represents a single sequence of instructions within a program.

Key points

Why threads matter

Trade-offs

Because threads share memory, they must carefully coordinate access to shared data (otherwise you get race conditions, deadlocks, etc.). Synchronization tools like locks, mutexes, and atomic operations exist for this purpose.

In short: a thread is a lightweight, independently scheduled path of execution inside a process.

explain different type of thread in programming languages such as green thread I have heard or go programming language concurrency feature

Here’s a clear breakdown of the main kinds of threads / concurrency models you’ll encounter in programming languages:

1. OS / Native Threads (Kernel Threads)

2. Green Threads (User-space Threads)

3. Go’s Goroutines (Modern M:N Green Threads)

Go’s concurrency feature is the best-known modern example of green threads:

Why it works well: Extremely cheap to create, efficient, and the runtime handles blocking I/O by parking the goroutine and using another OS thread.

Quick Comparison

Type Managed by Weight Typical Scale Examples
OS Thread Operating System Heavy Hundreds–thousands Java threads, C++ std::thread
Green Thread Runtime/Library Very light Tens/hundreds of thousands Early Java, many coroutines
Goroutine Go runtime Extremely light Millions Go

Related Concepts

Summary: