LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 03-30-2011, 03:51 AM   #1
jigsaw207
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Rep: Reputation: 0
Linux process scheduling and CPU utilization


Hi All,

I have a stupid question . Linux kernel has its own process scheduler algorithms and it grants processes the chance to run based on credit algorithm, according to this algorithm the more cpu time a process accumulates the lower its priority becomes.

My question: based on the above information, why we see sometimes one process eating up all CPU ? does it take high credit from the kernel ? or its instructions need more CPU cycles ?

specially java programs it takes alot of cpu utilization.

Thanks.
 
Old 03-30-2011, 05:16 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,445

Rep: Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068Reputation: 1068
IIRC the CFS uses a r-b tree to track process usage - if there is no process more "deserving" of using the processor, a "hungry" task will continue to get scheduled.
java is a CPU pig - well, it's just a piece of crap all round I guess ...
 
Old 03-30-2011, 06:02 AM   #3
hf2046
Member
 
Registered: Mar 2011
Distribution: Slack64
Posts: 109

Rep: Reputation: 20
Quote:
Originally Posted by jigsaw207
I have a stupid question . Linux kernel has its own process scheduler algorithms and it grants processes the chance to run based on credit algorithm
Not a stupid question at all. If you really want to know the answer, you probably need to look at this book (now horrendously outdated) - Understanding the Linux Kernel - Process Scheduling - and then diving into the kernel source itself. Most of the relevant code is in linux/kernel/sched.c. There are different scheduling policies depending on your kernel version and whether they're enabled or not. I'd be curious to know how the 2.6.x kernel does it as I only mucked around with the kernel when it was 2.2.x and I was in school...
 
Old 03-30-2011, 09:27 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 11,396
Blog Entries: 3

Rep: Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482Reputation: 1482
Hi,

Welcome to LQ!

Kernel Interactive Map will help you to understand visually.

If you look at Linux Kernel section of Slackware®-Links
you can find several good reference links;

Quote:
Anatomy of the Linux kernel: 'The Linux® kernel is the core of a large and complex operating system, and while it's huge, it is well organized in terms of subsystems and layers. In this article, you explore the general structure of the Linux kernel and get to know its major subsystems and core interfaces. Where possible, you get links to other IBM articles to help you dig deeper'
IBM's white-paper provides some useful insight.

Two good links to books;
Quote:
Linux Kernel in a Nutshell: Good read! downloadable
KernelBooks: Covering Linux 2.4 and Linux 2.6, as well as particular kernel subsystems
In the above you will find loads of definitive information. Some will be dated but relative to the current kernel. If you look at Kernel Newbies Frontpage you can keep up to date with changes.
 
Old 03-31-2011, 03:16 AM   #5
jigsaw207
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you all very much, I will go through the links you provided and read more, you were a great help.

The idea of my question was to try to understand when it is bad to have high CPU load and when this load affects server performance as long as there is a scheduling algorithm that takes care of giving the opportunity for each process to run and this algorithm want to utilize the CPU as much as possible. This is the source of my confusion I guess

Thanks alot guys you are the best
 
  


Reply

Tags
algorithm, kernel, process, scheduling


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
process memory,CPU utilization kbarani Linux - Software 1 01-07-2009 04:50 AM
per process Cpu utilization kunal_patel22 Linux - Software 4 12-04-2007 06:14 PM
Per-process %CPU Utilization first_linux Linux - General 3 06-01-2007 12:53 PM
per process cpu utilization kunal_patel22 Linux - Software 1 05-19-2005 11:26 AM
Process scheduling (CPU) kiwi_bloke *BSD 1 08-29-2004 10:07 PM


All times are GMT -5. The time now is 02:53 PM.

Main Menu
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