KernelTrap: Listing Threads in /proc
Feb 25, 2003, 04:00 (0 Talkback[s])
"The /proc directory on a Linux server is a virtual filesystem
(procfs) providing an interface between the kernel, kernel modules,
and user space processes. A quick 'ls -l /proc' reveals numerous
apparently empty files, though a 'cat' of of these 'empty' files
offers a wealth of interesting information generated by the kernel.
(The kernel configuration option CONFIG_PROC_FS must be
enabled)
"Within the /proc directory each running process has a
subdirectory, each named an integer which is the process' ID (PID).
Within these subdirectories are a number of files offering useful
information about each process. For example, the file 'cmdline'
(/proc//cmdline) shows the command line arguments passed to this
process, and 'environ' (/proc//environ) shows all environment
variables known to the process.
"Ingo Molnar recently posted a patch to the lkml resulting in a
significant increase in threading performance when displaying
individual threads within the /proc directory. His solution is to
add a '.' to child-thread entries, thus hiding them unless there's
a need to view them. He also adds a ''lookup cursor' cookie' for
further optimization..."
Complete
Story
Related Stories: