liveBook · Manning

Logical thread

As explained in Learn Concurrent Programming with Go

A user-level thread is a thread managed by a language runtime or user-space library rather than directly by the operating system kernel.

A logical thread is a user-level thread: a unit of execution managed inside an application by a language runtime or user-space library rather than directly by the operating system. The operating system sees the containing process as having one kernel-level thread, while the runtime schedules and switches among its logical threads. section 2.3.2

Go models logical threads with goroutines. A goroutine is neither an operating-system process nor an OS thread; current Go implementations group goroutine executions onto OS threads and let the Go runtime manage their execution. section 2.3.2 section 1.5.1

A logical-thread design separates application-level concurrency from kernel-level scheduling:

  • Keeps thread state, scheduling, and context switching in a runtime-managed table inside the process. section 2.3.2
  • Lets a program create many goroutines without directly managing one operating-system thread for each concurrent task. section 1.5.1
  • Relies on the runtime and hardware to determine how concurrent executions scale across available kernel-level threads. section 1.5.1
Figure 2.9 User-level threads executing within a single kernel-level thread

Shows logical threads executing within a single kernel-level thread, making the boundary between user-space execution and operating-system visibility concrete. section 2.3.2

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains runtime scheduling, state management, and context switching, while noting that Go’s specification does not guarantee a specific implementation.
Examples
Uses a diagram of user-level threads inside one kernel-level thread and goroutines mapped onto kernel-level threads.
What it assumes
Assumes basic familiarity with processes and threads, while distinguishing kernel-level threads from user-level threads.
What you can do after
Understand how Go separates goroutine creation from operating-system thread management.
How it connects
Connects logical threads with goroutines, kernel-level threads, processes, the Go runtime, parallelism, and channels.

Also explained in

Compare how 3 books explain logical thread →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Concurrent Programming with Go. The section links point to the parts of the book it draws on.