LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-18-2020, 04:57 AM   #1
zeeshanharis
LQ Newbie
 
Registered: Jan 2020
Posts: 3

Rep: Reputation: Disabled
What is the major difference between proc and sys?


what is the actual difference between /sys and /proc directories?

okay, they are virtual file systems used to import kernel data structures and hardware information. And the fact that /proc also has running process info stored and sys has the whole system and kernel info stored what is meant by that?

How does /proc identify the hardware such that it displays its vendor and other stuff, are there any rules through which it decides this info?

Why /sys has only one value per file for all the device attributes?

which of these is Udev dependent on?

How often Linux checks for hardware errors and where does that happen? Machine check errors, where are they stored?
 
Old 01-18-2020, 05:25 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by zeeshanharis View Post
what is the actual difference between /sys and /proc directories?
Roughly, proc exposes process information and general kernel data structures to userland. sys exposes kernel data structures that describe hardware (but also filesystems, SELinux, modules etc). I don't have the impression that the distinction is very sharp, and there is definitely some overlap.
Quote:
And the fact that /proc also has running process info stored and sys has the whole system and kernel info stored what is meant by that?
It's not clear to me what you want to know.
Quote:
How does /proc identify the hardware such that it displays its vendor and other stuff, are there any rules through which it decides this info?
It's sys rather than proc that displays hardware. What happens is that the PCI bus (or whatever other bus is used; PCI in most situations) discovers hardware at boot time and when it is added on the fly, and the PCI bus drivers get that information. The rules are based on the PCI standard. After discovery, we have kernel data structures that describe the hardware, and /sys exposes them to you and me.
Quote:
Why /sys has only one value per file for all the device attributes?
Code:
# cat /sys/block/dm-2/stat
     143        0     2428      208       10        0     4121      333        0      526      541
But it is true, most regular files under /sys represent a single device attribute or a specific action that you can trigger by writing to the file. I would think it makes it easier to manage device properties this way, but I am speculating. To me, it makes a lot of sense.
Quote:
which of these is Udev dependent on?
Definitely /sys, probably also /proc.
Quote:
How often Linux checks for hardware errors and where does that happen? Machine check errors, where are they stored?
I don't think that there is a single answer. Each subsystem or driver has its own way to check for errors, or doesn't check at all. Where are errors stored? In the data structures that describe hardware, I would say.

Last edited by berndbausch; 01-18-2020 at 05:27 AM.
 
Old 01-18-2020, 06:16 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,145

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
/proc is the wild west - a hangover from *nix history. Any script-kiddy can create a "file" in /proc and export whatever.
/sysfs is an attempt by the kernel devs to enforce some structure. Any tool may use either and/or both, although new code is encouraged to use only the latter. But it's Linux ... :shrug:

Last edited by syg00; 01-18-2020 at 06:42 AM. Reason: typo
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
whats the difference between /proc/sys and /sys sigint-ninja Linux - Newbie 1 01-15-2015 10:38 PM
What is the prime difference between Sys 3,Sys V and System7 version of UNIX vinnie_vinodh Other *NIX 2 11-16-2010 06:01 AM
difference between /proc and /sys? KeshavSubash Linux - Newbie 1 06-10-2010 02:27 AM
Diff between /sys/module and /proc/modules shariefbe Linux - Newbie 1 12-06-2009 06:12 AM
Boot hang after 'proc on /proc type proc (rw)' Hagoromo Slackware 13 10-05-2007 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration