Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does linux-kernel read proc/pid file?

How and Where does linux-kernel read proc/pid file which shows all processes in the system. I found linux-source-2.6.31/fs/proc/ Here there are files, but it is hard to understand because it is really complicated. Can someone knows, how it works?

like image 747
Iguramu Avatar asked Nov 22 '09 00:11

Iguramu


1 Answers

/proc is a pseudo-filesystem, meaning that its contents are not "real" files. Instead, the contents are a representation of the kernel's internal data structures. Therefore the kernel doesn't need to read them - it can already access the data directly.

/proc is used by user-mode (i.e. non-kernel) programs such as ps to find out (for instance) about processes running on the system. There's a man page that describes much of what's available.

like image 132
SimonJ Avatar answered Sep 18 '22 06:09

SimonJ