Sysfs and procfs

From Initq
Jump to: navigation, search

IIRC it was because /proc was meant to be to store process information but then turned into a maze of twisty directories with all sorts of random data dumped into it - including device information.

Sysfs on the other hand is designed to be a representation of the kernel device model. For that reason stuff isn't just dumped in, the position of nodes with sysfs actually represents the hierachy of devices in relation to their subsytems.

proc is the old one, it is more or less without rules and structure. And at some point it was decided that proc was a little to chaotic and a new way was needed.

Then sysfs was created, and the new stuff that was added was put into sysfs like device information.

So in some sense they do the same, but sysfs is a little bit more structured.

   Why are they made as file systems?

Unix philosophy tells us that everything is a file, therefore it was created so it behaves as files.

   As I understand it, proc is just something to store the immediate info regarding the processes running in the system.

Those parts has always been there and they will probably never move into sysfs.

But there is more old stuff that you can find in proc, that has not been moved.