首页 > 其他 > 详细

A quick renice command rescheduled the upgrade to a lower priority and I was back to surfing in no time.

时间:2016-12-31 10:30:12      阅读:283      评论:0      收藏:0      [点我收藏+]

 

Changing Priority on Linux Processes

What is Priority and Why Should I Care?

When talking about processes priority is all about managing processor time. The Processor or CPU is like a human juggling multiple tasks at the same time. Sometimes we can have enough room to take on multiple projects. Sometimes we can only focus on one thing at a time. Other times something important pops up and we want to devote all of our energy into solving that problem while putting less important tasks on the back burner.

In Linux we can set guidelines for the CPU to follow when it is looking at all the tasks it has to do. These guidelines are called niceness or nice value. The Linux niceness scale goes from -20 to 19. The lower the number the more priority that task gets. If the niceness value is high number like 19 the task will be set to the lowest priority and the CPU will process it whenever it gets a chance. The default nice value is zero.

By using this scale we can allocate our CPU resources more appropriately. Lower priority programs that are not important can be set to a higher nice value, while high priority programs like daemons and services can be set to receive more of the CPU’s focus. You can even give a specific user a lower nice value for all of his/her processes so you can limit their ability to slow down the computer’s core services.

Checking the Priority of Running Processes

The easiest way to get a quick picture of what the current niceness priority on a process is to open up the top processes with:

 

top

top

 

 q 

 

 h

 

 

 

 1 Fields Management for window 1:Def, whose current sort field is %CPU
 2    Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,
 3    d or <Space> toggles display, s sets sort.  Use q or <Esc> to end!
 4 
 5 * PID     = Process Id
 6 * USER    = Effective User Name
 7 * PR      = Priority
 8 * NI      = Nice Value
 9 * VIRT    = Virtual Image (KiB)
10 * RES     = Resident Size (KiB)
11 * SHR     = Shared Memory (KiB)
12 * S       = Process Status
13 * %CPU    = CPU Usage
14 * %MEM    = Memory Usage (RES)
15 * TIME+   = CPU Time, hundredths
16 * COMMAND = Command Name/Line
17   PPID    = Parent Process pid
18   UID     = Effective User Id
19   RUID    = Real User Id
20   RUSER   = Real User Name
21   SUID    = Saved User Id
22   SUSER   = Saved User Name
23   GID     = Group Id
24   GROUP   = Group Name
25   PGRP    = Process Group Id
26   TTY     = Controlling Tty
27   TPGID   = Tty Process Grp Id
28   SID     = Session Id
29   nTH     = Number of Threads
30   P       = Last Used Cpu (SMP)
31   TIME    = CPU Time
32   SWAP    = Swapped Size (KiB)
33   CODE    = Code Size (KiB)
34   DATA    = Data+Stack (KiB)
35   nMaj    = Major Page Faults
36   nMin    = Minor Page Faults
37   nDRT    = Dirty Pages Count
38   WCHAN   = Sleeping in Function
39   Flags   = Task Flags <sched.h>
40   CGROUPS = Control Groups
41   SUPGIDS = Supp Groups IDs
42   SUPGRPS = Supp Groups Names
43   TGID    = Thread Group Id
44   ENVIRON = Environment vars
45   vMj     = Major Faults delta
46   vMn     = Minor Faults delta
47   USED    = Res+Swap Size (KiB)
48   nsIPC   = IPC namespace Inode
49   nsMNT   = MNT namespace Inode
50   nsNET   = NET namespace Inode
51   nsPID   = PID namespace Inode
52   nsUSER  = USER namespace Inode
53   nsUTS   = UTS namespace Inode

 

A quick renice command rescheduled the upgrade to a lower priority and I was back to surfing in no time.

原文:http://www.cnblogs.com/yuanjiangw/p/6238781.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!