LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 10-22-2012, 11:48 PM   #1
tomatofj
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
How Linux get the cpu information to record in the cpuinfo file


Hi,

I am checking the /proc/cpuinfo. I am courious how linux get those cpu information and put them in the cpuinfo file. Can anyone know how linux does?

Tom,
 
Old 10-23-2012, 04:35 AM   #2
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
It prep the info from CPU and write into that file I guess.
 
Old 10-23-2012, 11:32 AM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
Everything in the /proc directory is "imaginary." Every file that you see, every directory, is actually an output that is generated on-the-spot. You can therefore browse the Linux source-code to see for yourself exactly how /proc/cpuinfo is produced, because you will find the subroutine that generates every line that you see.

For example, if you do ls /proc, you will see a "directory" for every process-ID in the system at that particular instant in time. The kernel subroutine that's responding to your ls command has generated a "directory entry" for every process that it saw at this instant.

If you then did ls /proc/12345, another subroutine will determine if process #12345 exists at this instant, and if so it will produce a "directory listing" for the various bits of info that you could obtain; if not, it produces "file not found."

Last edited by sundialsvcs; 10-23-2012 at 11:35 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Collect record information in Linux DNS sandeep_hello Linux - Server 9 02-23-2012 01:25 AM
/proc/cpuinfo does not show the correct information theburningcat Linux - Hardware 4 02-14-2011 08:05 AM
CPUINFO description - slow CPU? eraosso Slackware 2 01-01-2008 03:23 PM
Missing CPU in /proc/cpuinfo xerophyte Linux - Hardware 0 03-03-2006 11:20 AM
2 CPUs machine but /proc/cpuinfo only record 1 senget76 Linux - Hardware 3 01-06-2006 02:28 AM


All times are GMT -5. The time now is 06:28 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration