Pcornel
Windows · Processes

Threads

Cheat sheet · https://pcornel.dk/topic.php?topic=3008

Back to the Topic

Answer

A thread is the basic execution unit scheduled by Windows. Threads inside the same process share the process virtual address space and most resources, while each thread maintains its own execution context such as stack, registers, thread-local storage and scheduling state.

Remember

  • The scheduler schedules threads, not whole processes.
  • Threads in a process share memory and handles reachable through the process, so one bad thread can affect shared state.
  • A low-CPU thread may still be the blocking thread if it is waiting or deadlocked.
  • Thread IDs have lifetimes just like PIDs and are not permanent identifiers.
  • Thread count alone is not a health metric; trend and state matter.

First checks

  • Get-Process | Sort CPU -Desc | Select -First 10 Name,Id,CPU,WS — top processes
  • Get-CimInstance Win32_Process -Filter "ProcessId=<pid>" | Select Name,ParentProcessId,CommandLine — command line and parent
  • tasklist /v — processes with user and status
  • taskkill /PID <pid> /T — stop a process tree

Verify in this order

process → threads scheduled on CPUs → run or wait

Where it usually breaks

First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.

Processes → Threads reference map

ItemMeaningEvidence boundary
Thread IDRuntime identifiervalid for that thread lifetime
CPU timeProcessor time consumedactivity, not usefulness
Wait/stateScheduling conditionwhere execution is blocked or runnable
StackCall pathstrong context for current code path
TLS/stackPer-thread statedistinct from shared process address space

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3008

Confirmation

Confirm action

Continue?