Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need the source code for top and find the connection between top and /proc/ directory in linux

I wanted the source code for top which I could not find anywhere also, i wanted a little more information on what exactly does the /proc directory contain.y I have seen it have a series folders labeled 1, 2, 3 4, .... and in those folders there seem to be a consistent set of files. I was wondering if these are the directories for the processes running on the machine at the moment.

Also I wanted to know, how exactly TOP linked to this folder because I have been told that the processes are monitored by TOP, by fetching data from these directories. I would like to know which file exactly is TOP getting the CPU usage of the particular process from with the directory. If it's too complicated it would be great if you could just point me to the portion of the code where I could actually understand this from!

Thanks for your help Shouvik

like image 410
Shouvik Avatar asked Dec 22 '22 00:12

Shouvik


1 Answers

like image 199
Matt Joiner Avatar answered May 14 '23 22:05

Matt Joiner