LinuxQuestions.org
Review your favorite Linux distribution.
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 04-06-2021, 12:05 PM   #1
dba_not_adm9
LQ Newbie
 
Registered: Jan 2021
Posts: 4

Rep: Reputation: Disabled
Understanding TOP & SAR CPU Util for User process


Hello-

I am trying to understand how to properly use TOP & SAR. I am on Oracle Linux 7, there is a process that is running into issues and in TOP shows 100% for CPU, however SAR does not show CPU at 100 but somewhere in 20,15 % range. This server has hyper threading and is a 16 processer( from cat /proc/cpuinfo).

Does Linux by default allocate CPU per process ? So of 16 CPU only 1 is at 100% ? IS there any settings I should look into ? I am not trying to increase CPU for that process but want to understand why top & sar show different values.
 
Old 04-06-2021, 06:53 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,131

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by dba_not_adm9 View Post
Does Linux by default allocate CPU per process ? So of 16 CPU only 1 is at 100% ?
A single process can, by definition, only occupy a single CPU (core/physical thread/whatever) at any instant in time. It doesn't always have to be the same CPU although for performance reasons (cache, TLB flushing) it often is. This applies to every operating system ever invented.
Quote:
... but want to understand why top & sar show different values.
Because you're comparing apples to oranges.
In top the values for individual processes are un-normalised - simply the total CPU usage for the latest time period. For a non-threaded process this will never exceed 100% except for rounding errors. For a (busy) multi-threaded task, it may exceed 200 or 300%.
Depending on the options passed to sar you are likely looking at the total CPU usage for the entire system - and as mentioned your busy task may not reside on one CPU exclusively. You can also see the individual CPU usage in the summary data of top.
 
Old 04-07-2021, 03:02 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Quote:
Originally Posted by syg00 View Post
A single process can, by definition, only occupy a single CPU (core/physical thread/whatever) at any instant in time.
I would rather say a single threaded process can only use a single core. But multithreaded processes may use more cores at any time.
 
  


Reply

Tags
cpu usage, sar, top



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
LXer: SAR – Linux System Performance Monitoring Tool (Check Linux System Activity Report Using the SAR Command) LXer Syndicated Linux News 0 09-16-2019 05:00 PM
LXer: SAR – Linux System Performance Monitoring (Check Server Activity Logs Using SAR Command) LXer Syndicated Linux News 0 01-23-2017 04:27 PM
[SOLVED] Are the programs in util-linux the same version as those in util-linux-ng? harryhaller Slackware - Installation 2 10-07-2011 09:43 AM
top, ps, sar which gives accurate data for CPU utilization makam.sreekanth Linux - Newbie 6 03-20-2009 09:39 AM
Gotta love those ٱٱٱٱٱٱٱ&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

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

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