OSDev.org
https://forum.osdev.org/

process states ps vs. Andrew Tanenbaum
https://forum.osdev.org/viewtopic.php?f=15&t=33355
Page 1 of 1

Author:  ggodw000 [ Wed Dec 05, 2018 2:22 am ]
Post subject:  process states ps vs. Andrew Tanenbaum

I am studying the minix processes section of Andrew Tanenbaum's OS design and implementation book. There the topic of processes progresses into mutex and semaphores and describes process having state of
- running
- block
- sleep
Now it is academic book and not as complicated as real-life scenario.

But on "man ps" the process has about 9 states. Not sure how some of above three maps into below:
I am assuming:
- running -> R running or runnables
- block -> Not sure on this one???
- sleep -> S interruptable sleep.

PROCESS STATE CODES top
Here are the different values that the s, stat and state output
specifiers (header "STAT" or "S") will display to describe the state
of a process:

D uninterruptible sleep (usually IO)
I Idle kernel thread
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by
its parent

Author:  alexfru [ Wed Dec 05, 2018 3:54 am ]
Post subject:  Re: process states ps vs. Andrew Tanenbaum

I don't have the original (1st ed) MINIX book handy, but in others that I can peek, the process states listed (at the beginning of the processes chapter) are a bit different:
  • running
  • ready
  • blocked

Author:  nullplan [ Wed Dec 05, 2018 10:48 am ]
Post subject:  Re: process states ps vs. Andrew Tanenbaum

ggodw000 wrote:
D uninterruptible sleep (usually IO)
I Idle kernel thread
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent


I think you are right with your mapping. Additionally, D, T, t, and W merely denote specializations of being blocked, and I appears to be a special kernel-mode sleep state. X and Z denote garbage someone has yet to clean up, not a real process.

Author:  ggodw000 [ Wed Dec 05, 2018 12:33 pm ]
Post subject:  Re: process states ps vs. Andrew Tanenbaum

it is getting quickly confusing.
Looked up number of sites, each has different terms:
So far https://www.tutorialspoint.com/operatin ... duling.htm has good explanation in regards to
job scheduler (long term scheduler), CPU scheduler (I assume it is task scheduler or context switching) and then describes about different types of queue.
Ready queue is all processes residing in main memory whereas job queue is managed by job scheduler apparently.

By definition from https://wiki.osdev.org/Blocking_Process:
Blocking - state of wait, waiting for event i.e. semaphore released. Not in active scheduling queue.
Sleep - Process is set inactive for period of time (i.e. 20ms) while in a sleeping queue.

Now there is an "active scheduling queue" vs. ready queue, I am assuming they are same.
In the definition of sleep, there is a "sleeping queue" mentioned.

This link also had good explanation, but mentions about runqueue:
http://www.informit.com/articles/articl ... 0&seqNum=2

:roll: :roll:

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/