Processes and threads
As a programmer, you probably already have some understanding of what a process is. As operating systems look at it, a process is a rough equivalent of an application. When a user starts an application, an operating system creates and starts a new process. The process owns the application code and all the resources that the code uses—memory, file handles, device handles, sockets, windows, and so on.
When the program is executing, the system must also keep track of the current execution address, the state of the CPU registers, and the state of the program’s stack. This information, however, is not part of the process, but of a thread belonging to this process. Even the simplest program uses one thread.
In other words, the process represents the program’s static data while the thread represents the dynamic part. During the program’s lifetime, the thread describes its line of execution. If we know the state of the thread at every...