# what do all the states in top mean?



## wonslung (Jun 19, 2009)

i'm curious if anyone knows where i can find a list of the "states" shown in top, i tried to search and dind't see much.

I see a LOT of processes in the "kqread" state not chaning much, and i was wondering what it meant....some of it i can figure out, like i assume zio means zfs io or something 

i'm GUESSING kqread is something to do with the kernel and read but i really have no clue...


----------



## DutchDaemon (Jun 19, 2009)

That would be kqueue(2).


----------



## graudeejs (Jun 20, 2009)

When I watched video about Benchmarking FreeBSD (from FreeBSD site), guy told, that if all states in top aren't documented, and if someone really want's to figure it out, he have to din in source of top


----------



## vivek (Jun 20, 2009)

top command man page also explains output.


----------



## blah (Jun 20, 2009)

you can see similar info via [cmd=]mwchan[/cmd] column in ps(1)

```
$ ps Omwchan
  PID MWCHAN  TT  STAT      TIME COMMAND
 1250 kqread  ??  Is     0:00.93 /usr/sbin/nscd

$ ps l
  UID   PID  PPID CPU PRI NI   VSZ   RSS MWCHAN STAT  TT       TIME COMMAND
    0  1250     1   0  44  0 11604  2156 kqread Is    ??    0:00.94 /usr/sbin/nscd
```


----------



## ed@ (Jun 22, 2009)

Hi wonslung,

Just to put it (very) simple: in FreeBSD, all processes are either capable of running (placed on the run queue of the scheduler) or are waiting for some activity (blocked, placed on sleep queues). When processes are blocked on sleep queues, they can specify a wait channel message, which is the column you are describing. You can also see this message show up if you press ^T in the terminal:

$ 
load: 0.00  cmd: sh 97917 [ttyin] 5.75r 0.00u 0.00s 0% 1364k

As you can see, the process is blocked on "ttyin", which means the process is waiting for input on the TTY, which makes sense.

These states aren't documented, mainly because the strings that are used are spread throughout the tree and are subject to change. "kqread" just means a process is blocked on kqueue(2). "select" means a process is blocked on select(2). "nanslp" means a process sleeping on a nanosleep(2) call.


----------



## quintessence (Nov 8, 2010)

Hello , 

What about state *Name , what does it mean ?

I found only similar name as parameter *NameBuffer in AcpiNsBuildExternalPath function , but ...


----------



## ed@ (Nov 8, 2010)

So you want to know what it means when the string starts with an asterisk? That means it's currently blocked on a lock (e.g. a mutex) inside the kernel.


----------



## quintessence (Nov 8, 2010)

Hello , 

No , I want to know what means Name in *Name


----------



## ed@ (Nov 9, 2010)

quintessence said:
			
		

> Hello ,
> 
> No , I want to know what means Name in *Name



It's a description of the lock. Each lock in the kernel also has a wchan-like string associated with it.


----------



## quintessence (Nov 9, 2010)

Hello , 

Yes, but where I can find info what does exactly mean this description Name :stud

I have processes which sometimes stucks in *Name state for a while , and I wonder what exactly causing the lock , and because currently I don't have compiled any debug info ( or sysctl enabled ) I believe it is somewhere documented / mentioned . And until now I found related info ( similar to *Name ) only in sys/dev/acpica .


----------



## ed@ (Nov 9, 2010)

That's probably the name cache:

`fgrep -r '"Name' /sys/kern`


----------

