Processes and Threads
An instance of a running application is known as a process. Actually, that's a misnomer. Processes don't actually run—threads do. Every process has at least one thread (the main thread) but can have many. Each thread represents an independent execution mechanism. Any code that runs within an application runs via a thread.
Each process is allotted its own virtual memory address space. All threads within the process share this virtual memory space. Multiple threads that modify the same resource must synchronize access to the resource in order to prevent erratic behavior and possible access violations. A process that correctly serializes access to resources shared by multiple threads is said to be thread-safe.
Each thread in ...
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