model of threads in OS code example
Example: threads in os
A thread is a flow of execution through the process code,
with its own program counter that keeps track of which instruction to execute next,
system registers which hold its current working variables,
and a stack which contains the execution history.
A thread is also called a lightweight process.