Three Process States from a Programmer’s Perspective
From a programmer’s viewpoint, processes can be in three states—running (or ready), suspended (e.g., waiting for signals like SIGCONT after sleep or wait), and terminated (after exit or Ctrl+C), with explanations of how signals control transitions and what each state signifies.
From a programmer’s perspective, a process can be in three states.
1. Running – The process is currently executing or ready to be scheduled.
2. Suspended (also called stopped) – The process is temporarily paused, for example by calling sleep() or wait() , and will remain so until it receives a SIGCONT signal.
3. Terminated – The process has ended permanently, awaiting parent cleanup or already reclaimed; common ways to terminate include calling exit() or pressing Ctrl+C in a CLI.
Note: Some may wonder about the difference between “waiting to be run” in the running state and “suspended”.
Answer: A suspended state occurs after the kernel receives a stop signal such as SIGSTOP or SIGTSTP , putting the process on hold until a SIGCONT signal arrives. During this time the kernel will not schedule the process.
In contrast, a process in the running state that is “waiting to be run” signals to the kernel that it is ready and can be scheduled at any time.
php中文网 Courses
php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.