Tuesday, September 1, 2009

on Linux/x86, ps -l command gives a long listing. Field WCHAN in the listing caught my interest.

-bash-2.05b# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 21597 21595 0 76 0 - 1096 wait4 pts/2 00:00:00 bash
4 R 0 21677 21597 0 80 0 - 794 - pts/2 00:00:00 ps

looking at the man page, I could find out what it displays -

WCHAN address of the kernel function where the process is sleeping (use wchan if you want the kernel function name). Running tasks will display a dash (’-’) in this column.

‘ps -l’ uses System.Map file for reading the symbols.