LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-05-2014, 07:40 PM   #1
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
strange output frpm /proc/stat


Hi group,
While testing a new program on my Acer Aspire laptop running Fedora 13, I notice strange output from /proc/stat. The laptop has an AMD64 chip with 2 CPUs, when I start a loop script
Code:
while true ;do usleep 100; done
the output of /proc/stat shows both CPUs very busy.
I verified this with gnome-system-monitor. My program shows this:



I have access to one other machine and that one seams to produce valid output.

As anyone else noticed this anomaly?

Thanks for your time.
 
Old 11-06-2014, 02:38 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
I am curious what you are basing your evaluation of 'valid output' on?

Also, how have you confirmed that it is the loop causing the CPU usage?
 
Old 11-06-2014, 02:56 PM   #3
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
OK, after thinking about this, I found an answer that makes sense to me.

The loop I am using has a 'usleep 100' in it, that allows the task scheduler to switch the CPU/Processor and there by causing both of the CPUs to be used, putting a load on both of them. If I use this loop:
Code:
while true ;do :; done
only one CPU is used and that one is pegged at 100%.

Interesting in sight into the internals of an OS.
 
Old 11-06-2014, 03:52 PM   #4
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Not to beat a dead horse but the output plot shows another interesting observation.


The plot shows using both loops, the first major spike is using the usleep, the second major spike does not. Notice the higher system usage ( Blue ) on the first spike. The second spike shows very little system usage.

Don't know how useful this information is but it seams interesting to me.
 
Old 11-06-2014, 06:54 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Not sure if just me, but I am unable to see either attachment. Please make sure it is one of the types provided otherwise it will not display.
 
Old 11-08-2014, 03:40 PM   #6
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by grail View Post
Not sure if just me, but I am unable to see either attachment. Please make sure it is one of the types provided otherwise it will not display.
The images are on my server at 64.123.13.3. Try these links:

http://64.124.13.3/Images/pfssg.png
http://64.124.13.3/Images/pfssg_2.png
The second one is very interesting. It shows the outrages system overhead. More overhead than real work.

I ran this again on a 4 CPU machine with almost no real work being done. Here is the plot for that:

http://64.124.13.3/Images/pfssg_4.png
The first spike shows about 90% system overhead when using a 'usleep 100' in the loop? Almost no overhead when running the loop with no sleep. This is a serious flaw in the scheduler?

Would it be worth it to open a new thread pointed to the task scheduler??

Last edited by MrUmunhum; 11-08-2014 at 03:42 PM.
 
Old 11-03-2015, 02:38 PM   #7
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by MrUmunhum View Post
The images are on my server at 64.123.13.3. Try these links:

http://64.124.13.3/Images/pfssg.png
http://64.124.13.3/Images/pfssg_2.png
The second one is very interesting. It shows the outrages system overhead. More overhead than real work.

I ran this again on a 4 CPU machine with almost no real work being done. Here is the plot for that:

http://64.124.13.3/Images/pfssg_4.png
The first spike shows about 90% system overhead when using a 'usleep 100' in the loop? Almost no overhead when running the loop with no sleep. This is a serious flaw in the scheduler?

Would it be worth it to open a new thread pointed to the task scheduler??
The IP address for my server has changed, it is now:
  • mt-umunhum-wireless.net. 49 IN A 216.173.131.138
I am reopening this issue since it has not been resolved.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Historical documentation of /proc/stat otheus Linux - Software 6 10-06-2008 11:54 AM
euid and egid frpm proc sanjaykhuntia Linux - Enterprise 1 10-28-2007 09:26 PM
STAT() on directories of PROC ??? abhijit_awalekar Programming 2 09-07-2006 12:26 AM
STAT on directories of PROC ??? abhijit_awalekar Programming 1 09-06-2006 03:34 PM
/proc/stat cpu ahz Programming 1 04-24-2005 07:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:46 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