Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 10-22-2012, 10:48 PM   #1
LQ Newbie
Registered: Oct 2012
Posts: 1

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


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?

Old 10-23-2012, 03:35 AM   #2
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, 10:32 AM   #3
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,894

Rep: Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357Reputation: 1357
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 10:35 AM.


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

All times are GMT -5. The time now is 03:51 AM.

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