Thursday, February 23, 2017

What is D state process and how to check ? And what is the impact of it ?



To check the d state prcoess

#ps axl | awk '$10 ~ /D/'
#ps -aux

D state occurs when  the process is in uninterruptible sleep. This state is bad, because you can't do anything with the process in D state. Fortunately, process normally remains in such state not for so long. But if you have a heap of D state processes then some logic in system is disrupt. If that is happening, the very important thing is to determine where this unlucky sleep occurs. It is easy to do with ps command with l option. WCHAN column shows the name of the kernel function where the process is sleeping:


State D means uninterruptible sleep, which usually means IO. When the IO completes the process will change state.  If you think a specific process is hung you can truss or strace it to see what it is doing. i.e.

strace -p <pid of process>

If it does nothing for a long time it is more than likely stuck.


It may nothing to do with which disk folder.

The D state process effect cpu/processor scheduling.
Theoretically, D state still occupying cpu/processor resources.
So if too many D state processes, the cpus are busy on scheduling and re-scheduling (that is why we see high system load).

So the result could be unpredictable.



How to clear D-state process ?

D-state process is nothing but uninterruptible sleep. When doing IO, the process is locked as uninterruptible so the data will not be corrupted. When IO finished, the process will not be D-sate
But for some reason the IO could not be finished or hung, then the process may stick in D. in this cases we need to reboot the server to clear  D-state process.

5 comments:

  1. Thanks a lot for this useful post. Keep Sharing this kind of information.

    Linux Course in Chennai | Linux Training in Chennai

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Very informative article, Which you have shared here about the D state process. After reading your article I got very much information and it resolved many of my doubts. If anyone interested to know more about the PS Command in Linux, Visit linoxide

    ReplyDelete