Please Help Me With This Nice And Renice Stuff

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Please Help Me With This Nice And Renice Stuff
# 1  
Old 05-23-2002
Please Help Me With This Nice And Renice Stuff

i read a book about this a couple of times and i still find it confusing.

they talking about when you increase a priority number, that decreases nice number. I really dont understand this.

I'm working on a solaris and linux red hat 7.2 system.

if anyone can explain this stuff to me in full depth and also tell me the situation it is most used in, I will certainly appreciate it.

(please explain it in plain english)
# 2  
Old 05-23-2002
Let me help.

There are 2 commands nice and renice. First of all, nice is only used when you want to change the default priority level of the process that you are initiating. On all flavors of unix there is a default priority level for Users and for Root. I believe this can be modified, but I wouldn't mess with that. use renice instead.

Nice is used only at the time you kick off a script or a command from the command line to set the priority to something other than the default setting which is usually somewhere in the middle of the priority range. For some systems it is from +20 to -20. so the default could be around +10 for users and +-0 for Root.

Renice is only used when a process is running to change the priority level up or down.

Now, when you change the priority, A higher number is a lower priority. A lower number is a higher priority. Just think of the game of golf. lower is faster, better.

Hope this helps.

# 3  
Old 05-24-2002
If a higher number is a lower priority and a lower number is a higher priority, then tell me, what are the steps in making only the important process run while the less important ones be runned when the most important ones are done running?

meaning, I want to make all important processes run before the less important onces. By the way, how do I word that?? do I say I want to increase the priority or decrease??

by the way, if anyone is going to help me hear, can you please tell me the steps you would go thru when working on a solaris and linux red hat 7.2 system. I would prefer the answer to deal with Linux

thanks in advance
# 4  
Old 05-24-2002
In general only the root user can give a process a higher( lower number) priority. Users can only give a process a lower( higher number) priority.

In general for normal users, they can use the nice command but probably wouldn't because they have the best priority they can get with the default priority they are assigned, usually around +10 or so. They can, however, use nice to give a process a lower ( higher number) priority, if it is something that can take its time to complete.

For the nice command you can do something like this. It will give it the lowest priority possible. However, this can be dangerous if the process is CPU intensive. It could severly slow down your box! I would never go below -10, if your system priority goes from +20 to -20. Some OSs are different.

nice --20 /path/to/some/process

to change the nice value of this process.

renice -10 /path/to/some/process

Notice that I used 2 -- in the first example. The first dash is for the option. The second one is for the "sign" of the priority. You must give it a negative sign in order to increase the priority. REMEMBER, ONLY THE ROOT USER CAN INCREASE PRIORITY OF A PROCESS.

Read the man pages for more detail on this topic. man nice and man renice.

Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

More Arduino Stuff...

HI all... (Apologies for any typos.) To add to Neo's Arduino subject matter I have decided to upload this in ".zip" format. Ignore "*.info" files these are AMIGA icons only and also the "HAM" drawer as these are photos in ancient AMIGA HAM modes. I have noticed that there are current... (6 Replies)
Discussion started by: wisecracker
6 Replies

2. Shell Programming and Scripting

Renice command with input argument as a file

Hi all could you help me how to give pids in a file as an argument to renice command. Thanks in Advance.. :) Pradeep (4 Replies)
Discussion started by: nanz143
4 Replies

3. AIX

nice and renice

hello , We would like to increase the priority of the oracle process . Process(240001 ) should get the priority like the process(240103 ). Am not sure what value i should mention in the renice command(aix 6.1). Please assist me. 240001 A oracle 26804312 1 0 60 20... (2 Replies)
Discussion started by: gowthamakanthan
2 Replies

4. Shell Programming and Scripting

A schoolboyish stuff

Hi , This is a pretty simple sed command i found when i was checking out one of the codes of my colleague . sed -e 's/\*.*\) \(\ <1*e\ >\) \(*.*\)/\2/' When i tried this on a few text files it was displaying the entire line. If this was to display entire line why sweat out on a sed . Does... (3 Replies)
Discussion started by: kinny
3 Replies

5. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

6. UNIX for Dummies Questions & Answers

Renice job

Hi everyone, I am working on a server that there is a rule to renice your jobs if they exceed 1 hour of running. I wrote a script that calls a program that runs for some thousand times. When I do 'top' I can see in the processes the program running but not the name of my script that I run... (1 Reply)
Discussion started by: Farsinos
1 Replies

7. Windows & DOS: Issues & Discussions

weird stuff

I coudln't think of another topic to post this under as the OS on the system is XP pro. Ok here is the go. I'm upgrdaing a mates computer. A AMD 1200Mhz and well it wouldn't boot from the CD to do a fresh install (By upgrade I mean OS with complete new install). So I opened up the box and... (4 Replies)
Discussion started by: woofie
4 Replies
Login or Register to Ask a Question