Labels

Linux (46) network (13) troubleshoot (13) command (10) virtualization (10) ubuntu (9) Windows (8) cisco (7) security (7) router (6) Tools (5) software (5) vmware (5) ospf (3) eigrp (1) zimbra (1)

2010年1月20日

Change process priority - nice and renice

Nice number
• Range: -20 ~ +19
• User process default: 0
• + no. lower the priority
• - no. raise the priority
• Only root can lower the no.
• Don’t assign +no. to fg jobs -- sluggish

Syntax
• Just nice shows current priority
• nice [-n no.] [command]
• nice [-no.] [command]
• Normal user: no. = 1~19
• Root: no. = -20~19
• Not specified no.: default to 10

Examples

[law@localhost ~]$ nice seq 1000000&
Using default nice# 10 to reduce priority

[law@localhost ~]$ nice -n -10 vi /etc/hosts.deny
Start vi at high priority (-10)

renice
Modify nice no. of a running program
Syntax:
Renice [+|-]nicenumber [option] targets

Examples
[law@localhost ~]$ renice 19 501
 Lower process 501's priority
[law@localhost ~]$ renice -10 -u law -p 501
 Increase all law's process and process 501

沒有留言:

張貼留言