1

The manpage of ps says

PROCESS STATE CODES
   R  running or runnable (on run queue)
   D  uninterruptible sleep (usually IO)
   S  interruptible sleep (waiting for an event to complete)
   Z  defunct/zombie, terminated but not reaped by its parent
   T  stopped, either by a job control signal or because
      it is being traced

Wikipedia http://en.wikipedia.org/wiki/Process_state doesn't mention D, S and T states, at least explicitly.

Do D, S and T belong to ready state, blocked state or some other state?

3
  • 2
    Are you essentially asking how the generic process states listed on Wikipedia map to the process states as specifically implemented on a Unix-like system?
    – Anko
    Sep 2 '14 at 19:24
  • yes, i am. @Anko!
    – Tim
    Sep 2 '14 at 19:27
  • @Tim This is the best worst Q ever! Pl. read my answer. You trigger a whole avalanche of practical an theoretical things. From ctrl-Z to run queue in scheduler. This is fundamental. But I somehow reach a point now...just see and give a quick comment, if you can, please. Note my ps example, it is not just grey theory.
    – user373503
    Oct 19 '19 at 8:36
4

I don't know what you mean by "blocked" state, because there is no state called "blocked" in the Linux architecture. But, I can explain you what those states mean:

If you run a command from the shell, let's assume sleep 100, it first gets in the state R. It's running, but not very long, just a few slices of CPU time. A few times betwixt it will be in the uninterruptible sleep state D, because it's waiting for the hard disk. Then it gets in the interruptible sleep state S.

If you press Ctrl+Z you send SIGSTOP to the process. Then the process gets in the state stopped T. It will remain in this state until the signal SIGCONT will be sent. In this state, the process will not get CPU time.

When the process is exiting it gets in the state zombie Z until the parent process calls waitpid(), then the kernel removes the PID.

6
  • Thanks. In the linked Wikipedia article, a process in the "blocked" state means "A process that is blocked on some event (such as I/O operation completion or a signal). A process may be blocked due to various reasons such as when a particular process has exhausted the CPU time allocated to it or it is waiting for an event to occur."
    – Tim
    Sep 3 '14 at 6:46
  • @Tim in the wikipedia article they mean the state D when the process is waiting for I/O. Note that the wikipedia article is for process states in general, not the linux kernel process states.
    – chaos
    Sep 3 '14 at 7:11
  • @chaos your first two lines are quite misleading. Blocking is a well known concept and word, with clear connection to D and also T. Important word would be run queue. I guess the kernel also has one.
    – user373503
    Oct 18 '19 at 21:33
  • @rastafile Whats the problem with my first two lines? No state has the name "blocked" in linux, even if you could - if you want - describe some states as blocking. This is a 5 year old answer btw...
    – chaos
    Oct 18 '19 at 21:46
  • I found out the "hard" way that "blocking" as quite well explained in that wiki article, is a well-established techical term. Not well defined. "D" is IO-wait state, "blocked" also. "T" is also off the run queue. I do not even say D and T are both "blocked" states, but there is a connection (logically, semantically).
    – user373503
    Oct 18 '19 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.