LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-27-2008, 09:49 AM   #1
mokku
Member
 
Registered: Feb 2007
Posts: 197

Rep: Reputation: 30
Cpu usage question


I am running a LINUX server with 8 CPU's. If the CPU usage was 100 %
means what's the nature of the CPU usage calculation (That means all
the 8 CPU gives the 100 % usage ...? ).

Sometimes my CPU usage was crossing above 200% also. What it means...?

( Note I have 8 CPU's).

It means now CPU usage was 200/800(8 *100-for each CPU).

So how the Kernel is calculating the total CPU capacity.......?

Please explain with the examples...

My otehr questions is, if I have a script and if I want to use 200% percentage of cpu, how can I use it?

Thanks in advance

Last edited by mokku; 08-27-2008 at 09:56 AM.
 
Old 08-27-2008, 10:00 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
If you look at the CPU usage through the top command, the %CPU field is the sum of the percentages of each used CPU. If you have 8 cpu (or cores) and you run a parallel process which is properly scaled, you can see a %CPU of about 800, whereas a scalar process reaches at most 100% (that is it uses one CPU entirely).

If you press 1 (one) in top, the CPU usage in the global section (the upper part of the top output) will be splitted among all the available CPUs (details will be given for each single CPU).
 
Old 08-27-2008, 01:15 PM   #3
mokku
Member
 
Registered: Feb 2007
Posts: 197

Original Poster
Rep: Reputation: 30
Thank you for your reply, so If the script used 200 percentage, would it show as 200% or I need to check all the cpu to find the total percentage? Thanks in advance.
 
Old 08-28-2008, 03:06 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
The first you have told! At least for all the parallel processes I've ever seen on Linux systems, like Fedora, Ubuntu and OpenSuSE.

Just out of curiosity... which kind of script would reach such a performance, using 2 CPU? Is it something like Parallel Python?
 
Old 08-28-2008, 11:39 PM   #5
mokku
Member
 
Registered: Feb 2007
Posts: 197

Original Poster
Rep: Reputation: 30
Its a java thread that user needs to run and wanted to push the cpu to 200% and what is the good way to do it?
 
Old 08-31-2008, 09:34 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,735

Rep: Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523Reputation: 2523
If you want to pressure the cpu, you need a cpu-bound prog eg a simple calc in a tight loop
pseudo-code

while(1)
do
x = 1;
done

this would need to be manually stopped eg ctrl-C.The more complex you make it, the more likely it is to be swapped out of the cpu, esp if it involves any I/O eg checking keybd for stop signal.
 
Old 09-02-2008, 08:33 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179
The best way to understand this figure is to go look at the actual code in the Scheduler which computes it.

Generally speaking, the statistics are per process, and they are therefore pretty agnostic as to which CPU(s) participated. Commands like top then "roll-up" those per-process statistics into a summary.

When calculating overall workload of a CPU (for load-balancing purposes), the scheduler applies various "weighted-average"-type statistics to suppress the effect of the nanosecond-to-nanosecond variations that inevitably occur.

All of these things rely heavily on periodic sampling, again for the same reasons.
 
  


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
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM
CPU Usage Jehos Programming 3 11-30-2003 05:46 AM
CPU usage question infamous41md Linux - Newbie 2 04-01-2003 05:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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