Wednesday, 23 November 2011

What are the process states in Linux?

To find out what applications are causing the load, run the command ps faux. This will list every process running on your system, and the state it is in.

You want to look in the STAT column. The common flags that you should be looking for are:
  • R – Running
  • S – Sleeping
  • D – Waiting for something
So, look for any processes with a STAT of D, and you can go from there to diagnose the problem
The state of a process performing IO will be put in D state(uninterpretable sleep), which frees the CPU until there is a hardware interrupt which tells the CPU to return to executing the program. You can man ps to see the other process states.

Process states in Linux:

  • Running: Process is either running or ready to run
  • Interruptible: a Blocked state of a process and waiting for an event or signal from another process
  • Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal
  • Stopped: Process is stopped or halted and can be restarted by some other process
  • Zombie: process terminated, but information is still there in the process table.  
       D   uninterruptible sleep (usually IO)
       R   runnable (on run queue)
       S   sleeping
       T   traced or stopped
       Z   a defunct ("zombie") process
For BSD formats and when the "stat" keyword is used, additional letters may be displayed:
       W   has no resident pages
       <   High-priority process
       N   low-priority task
       L   has pages locked into memory (for real-time and custom IO)

No comments:

Post a Comment