Thread Basics
A running program is called a process. Associated with each process is a system state, which includes memory, lists of open files, a program counter that keeps track of the instruction being executed, and a call stack used to hold the local variables of functions. Normally, a process executes statements in a single sequence of control flow. This sequence is sometimes called a thread (or main thread).
When a program creates new processes by using the os.system(), os.fork(), os.spawnv(), and similar system calls, these processes run as independent programs—each with its own set of system resources and main thread of execution. However, it’s also possible for a program to create additional threads of execution that exist inside the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access