Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nice command

Status
Not open for further replies.

azzazzello

Technical User
Jan 25, 2005
297
US
Curious...how useful is it to use "nice" in system that has multiple CPUs?
 
It depends on the workload the machine has and how you want to prioritize the processing. If the machine is lightly loaded, then you probably won't notice much of a difference. If your machine is pegged at 100% and you want your "Seti @ Home" processing to give up some priority, then [tt]nice[/tt] can make it run at a lower priority.

I've also noticed that the priority a process runs at because of a [tt]nice[/tt] command only seems to be a "suggestion" at best. You can't always speed up a process that's running slow, or slow down one that's eating up the machine.

Bottom line is, go ahead and use it, but your mileage may vary.

Hope this helps.
 
Remember : NICE= 20 means the process will essentially hold the door for everyone who needs CPU access and wait for everyone to be out before using the CPU.

NICE= -20 means the process will sit on the CPU with a shotgun and shoot at anyone who tries to use the CPU.

Well, roughly.

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
That was a theory I had, but it turns out that they just gang up on other processes.
Kinda like two orcs who don't know each other and don't beat up each other upon meeting. Very odd. Rather like my comparisons.

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
from nice on multiple CPU machines to orcs...Nice
 
If you want a clear answer, here it is:
It's useful.
If you want to know where my knowledge ends, it's there:
--> I have no idea whether you'll end up using all CPUs or not. I _gather_ that you'll use as much processor power as you can...

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam.
 
There is a formula in the kernel code that calculates how many "ticks" a process gets while the kernel has it selected to run and the "nice" value of the process is a variable used to calculate that number.

It isn't magic, download the kernel source and find the calculation... I'll give you a hint, start in sched.h.

In a multi processor system the calculation is simply done once for each processor.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top