Appearance
11. Kernel Level vs User Level Threads
User Level Threads (ULT): managed entirely by a user-space library (old Java green threads, early Go). The kernel sees only one process; the library switches threads without any syscall.
Kernel Level Threads (KLT): managed directly by the OS kernel, which schedules each individually.
| Aspect User Level Kernel Level | ||
|---|---|---|
| Who manages | Thread library | OS kernel |
| Kernel awareness | Invisible | Fully visible |
| Context switch | No syscall — fast | Syscall — slower |
| Parallelism | No (single core) | Yes |
| I/O blocking | Blocks all threads | Blocks only that thread |
| Crash impact | One crash kills all | Isolated |
| Example | Old green threads | Linux pthreads |
Threading models: Many-to-One (pure ULT, fast switching, no parallelism), One-to-One (pure KLT, true parallelism, expensive switches — Linux pthreads), Many-to-Many (hybrid — M user threads over N kernel threads). Go's goroutines are the classic Many-to-Many example: thousands of goroutines multiplexed over a handful of OS threads.