LinuxQuestions.org
Register a domain and help support LQ
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
 
LinkBack Search this Thread
Old 10-21-2008, 03:16 AM   #1
akring
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Rep: Reputation: 0
Nice level set but process gets wrong priority


Hello all.

At work we have a Linux server (Ubuntu server 7.10) with 8 CPUs for doing heavy calculations. There are several users on the server and we need to prioritize the jobs we run. We are trying to do this using the nice command, but it is not working the way it is supposed to. Below, a screenshot from 'top' is included in a situation where the users andreas and bruger2 are running jobs. Both users have set up their calculations to use all 8 CPUs simultaneously (using MPI or similar), but andreas' processes are set to nice=0 while bruger2 uses nice=19.

Why do andreas' processes (mdrun) only get 4 CPUs when the nice levels are set as above?

It should get all 8 CPUs and bruger2's processes should wait until andreas' are done...

Regards
Andreas

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6989 bruger2 39 19 4572m 2.8g 3132 R 400 72.2 1746:45 l914.exe
7294 andreas 25 0 641m 19m 13m R 100 0.5 0:46.27 mdrun
7295 andreas 25 0 641m 18m 12m R 100 0.5 0:45.40 mdrun
7297 andreas 25 0 641m 18m 12m R 100 0.5 0:45.50 mdrun
7298 andreas 25 0 641m 18m 12m R 100 0.5 0:45.53 mdrun
1 root 18 0 5144 140 68 S 0 0.0 0:03.88 init
2 root 11 -5 0 0 0 S 0 0.0 0:00.02 kthreadd
3 root RT -5 0 0 0 S 0 0.0 0:00.10 migration/0
4 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
5 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/0
 
Old 10-24-2008, 11:23 AM   #2
grumpf
Member
 
Registered: Dec 2005
Distribution: just replace windows with linux
Posts: 38

Rep: Reputation: 15
i am not an expert on schedulers but this will never happen. the kernel will distribute time more often to processes with hier priority other processes to slow to craw but still work.
you will need to send a kill -stop pid and kill -cont pid to make that happen.
please be aware that most problems occur when two processes will fight for (heavy) disk access
causing a lot of waitstates.
 
Old 10-25-2008, 03:33 AM   #3
akring
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by grumpf View Post
i am not an expert on schedulers but this will never happen. the kernel will distribute time more often to processes with hier priority other processes to slow to craw but still work.
you will need to send a kill -stop pid and kill -cont pid to make that happen.
please be aware that most problems occur when two processes will fight for (heavy) disk access
causing a lot of waitstates.
Thanks for you answer. You claim that the situation I described above will never happen? But it IS happening - take a look at the output from top...? It is not a matter of two processes fighting for disk access - this is evident from the 'S' column in the top output which states that all the processes are in the 'R' mode (if they were writing to the disk they would display a 'D' in this column as far as I know).

Regards
Andreas
 
Old 10-26-2008, 07:13 AM   #4
grumpf
Member
 
Registered: Dec 2005
Distribution: just replace windows with linux
Posts: 38

Rep: Reputation: 15
ok, obviously i totaly misunderstood want you wanted.

the situation is (simplified):

burger2 (B) and andreas (A) running the same program.
You changed the nice level of B to 19 and that of A to 0

and you wonder why does B get 1 CPU while A get 4 ?

The nice level mean that B is a "nice" process an willing to give time.
to make a process more greedy use -1 or less careful.

making him too greedy would mean to collide with kernel space daemon what can be
desasterious.

6989 bruger2 39 19 4572m 2.8g 3132 R 400 72.2 1746:45 l914.exe
7294 andreas 25 0 641m 19m 13m R 100 0.5 0:46.27 mdrun
 
Old 10-27-2008, 01:55 AM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.2, Centos 5.8
Posts: 11,731

Rep: Reputation: 902Reputation: 902Reputation: 902Reputation: 902Reputation: 902Reputation: 902Reputation: 902Reputation: 902
'nice' is just a suggestion to the kernel. Its inherently designed to multi-task if possible. If a high priority task has to wait eg for disk access, then an equal or lower priority task will get some cpu time while its waiting for the data to arrive.

Quote:
A niceness should not be confused with a scheduling priority, which
lets applications determine the order in which threads are scheduled to
run. Unlike a priority, a niceness is merely advice to the scheduler,
which the scheduler is free to ignore.
from 'info nice'
 
Old 10-27-2008, 04:02 AM   #6
akring
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for you answers (grumpf and chrism01). Since a nice level is just a suggestion to the kernel (according to chrism01's post), is there a way that one can actually change the kernels priority of a process?

Regards
Andreas
 
Old 10-27-2008, 11:55 AM   #7
grumpf
Member
 
Registered: Dec 2005
Distribution: just replace windows with linux
Posts: 38

Rep: Reputation: 15
you may try this advise:
*http://www.cyberciti.biz/faq/howto-s...ority-process/
*http://www.linux.com/feature/58638

but this may also be important:
*http://oreilly.com/catalog/linuxkern...pter/ch10.html

ntl i would be very carefully to fiddle with real priority. you need to be aware of the needs
of the kernel ro you will render you system unusable.
 
Old 10-29-2008, 04:25 AM   #8
akring
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks a lot - I'll have a look at these links.

Regards
Andreas
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"ps" does not give nice value of process if realtime priority set... CJS Linux - General 1 07-16-2008 09:23 PM
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 10:22 AM
Nice vs Priority, how do I prioritise a cronjob? stefaandk Linux - General 5 08-11-2005 08:17 PM
'nice' priority is working backwards! wapcaplet Linux - Software 5 11-19-2004 09:46 AM
Scheduling priority for the 'nice' command savoiu Linux - Newbie 2 05-18-2004 11:35 AM


All times are GMT -5. The time now is 07:39 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
Open Source Consulting | Domain Registration