LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-04-2021, 09:07 AM   #1
alexrabbi
LQ Newbie
 
Registered: Jun 2021
Posts: 2

Rep: Reputation: Disabled
/proc


Hi All,

I am newbie here, I have quick question for which I could not get an answer anywhere.

I know that /Proc is a virtual file system and it stores system information and it is created on fly each time system boots up.

someone asked a question why is /proc created on fly ? why is it that way ?

I could not get a convincing answer anywhere. If anyone can explain, please do.

Regards,
Alex
 
Old 06-04-2021, 09:48 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
It's just a convenient interface provided by kernel following the Unix philosophy "everything is a file". This answers the question "Why is it a file system?" which is the correct one to ask.
 
1 members found this post helpful.
Old 06-04-2021, 10:42 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,996

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
actually it does not store anything, but will give information about a living (running) system.
 
1 members found this post helpful.
Old 06-04-2021, 10:50 AM   #4
alexrabbi
LQ Newbie
 
Registered: Jun 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shruggy View Post
It's just a convenient interface provided by kernel following the Unix philosophy "everything is a file". This answers the question "Why is it a file system?" which is the correct one to ask.
Actually it was in an interview he asked me why is it created on fly and why is not a permanently residing on server ?
 
Old 06-04-2021, 10:58 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,660
Blog Entries: 19

Rep: Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482Reputation: 4482
/proc isn't a real filesystem. It's a window into the running kernel dressed up as a filesystem for the user's convenience. It's created on the fly because each run of the kernel is different, at least potentially.

As well as info on the kernel, hardware drivers, etc., /proc contains the task structures created by the kernel for all running processes. These are the subdirectories with numbers for names. The numbers are the PIDs of the processes. Obviously this sort of info can't be permanently stored on disk.
 
1 members found this post helpful.
Old 06-04-2021, 12:38 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,996

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by alexrabbi View Post
Actually it was in an interview he asked me why is it created on fly and why is not a permanently residing on server ?
Because it is the state of the running system, which is [obviously] changing continuously.
 
1 members found this post helpful.
Old 06-04-2021, 05:08 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,147

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
The reason it doesn't exist on disk is that it is created in kernel cache - i.e. in RAM. You (the user) don't have to worry about mounting it, what filesystem it uses ...
 
Old 06-05-2021, 10:39 AM   #8
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,147

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
To make things a little clearer, consider this command
Code:
$: cat /proc/cpuinfo
Normally cat reads a file and copies the contents to the terminal. But there is no file there! What actually happens is that the OS gets the data represented by the name /proc/cpuinfo by sending a request to the CPU, which comes up with the information.

Now try
Code:
$: cat /proc/sys/kernel/sysrq
This asks the kernel if it recognises the "magic system request" key. If it replies "1" it does, if "0" it doesn't. This is one of the "entries" in /proc that you can actually alter (and that can sometimes be a dangerous thing to do!) with
Code:
$: echo 1 > /proc/sys/kernel/sysrq
To see the result, https://en.wikipedia.org/wiki/Magic_SysRq_key
 
  


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
Boot hang after 'proc on /proc type proc (rw)' Hagoromo Slackware 13 10-05-2007 05:03 PM
hidden directories under proc... what are they for? : (/proc/.23142) syssyphus Linux - General 1 04-10-2006 03:23 PM
how to know contents of /proc/ide/hda/smart_values and /proc/ide/hda/smart_threshold Prassanta SUSE / openSUSE 0 02-23-2006 04:21 AM
Correlation between /proc/devices and /proc/modules ColinLadyka Linux - General 1 02-13-2006 05:25 PM
What /proc proc file do I need? GoboFraggle Programming 1 02-04-2003 11:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:42 AM.

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