Threads
Cheat sheet · https://pcornel.dk/topic.php?topic=3008
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 processesGet-CimInstance Win32_Process -Filter "ProcessId=<pid>" | Select Name,ParentProcessId,CommandLine— command line and parenttasklist /v— processes with user and statustaskkill /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
| Item | Meaning | Evidence boundary |
|---|---|---|
| Thread ID | Runtime identifier | valid for that thread lifetime |
| CPU time | Processor time consumed | activity, not usefulness |
| Wait/state | Scheduling condition | where execution is blocked or runnable |
| Stack | Call path | strong context for current code path |
| TLS/stack | Per-thread state | distinct 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