Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] Tip of the Day: My system is slow because of some big process (so I want to change its priority)
- Date: Sat, 21 Jul 2007 14:09:05 +0900
- From: "Josh Glover" <jmglov@example.com>
- Subject: [tlug] Tip of the Day: My system is slow because of some big process (so I want to change its priority)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This TotD is also available in the wiki:
http://tlug.jp/wiki/Linux_Help:Tip_of_the_Day:My_system_is_slow_because_of_some_big_process_%28so_I_want_to_change_its_priority%29 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If you started some big hungry process (e.g. backing up a DVD) and now your system is not responsive enough for your Firefox / XEmacs / GQview / jUploadr workload, simply drop (well, "raise", in UNIX Land) the priority of the CPU hogging process:
1. Identify the process ID of the hog:
ps -u "${USER}" -O pcpu --sort pcpu | sed -e 1d | sort -nr -k 2 | head
See #Identifying the Process for an explanation 2. Change the priority of the process:
PID=<pid> # where <pid> is process ID from the previous step NICENESS=10 # or change 10 to any integer between 1 and 20, inclusive renice +${NICENESS} ${PID}
Your system should get noticeably more responsive!
See man 8 renice for more details.
[edit] Identifying the Process
Here is a breakdown of the pipeline (Wikipedia) we used above:
1.
ps -u "${USER}" -O pcpu --sort pcpu
(man 1 ps); show all processes for the current user, adding CPU usage (percentage) to the default display columns, sorting by CPU usage (percentage) 2.
sed -e 1d
(man 1 sed); delete the first line (i.e. ps's header) 3.
sort -nr -k 2
(man 1 sort); sort numerically in reverse (i.e. descending order) on column 2 4.
head
(man 1 head); display the first few lines only
-- Cheers, Josh
Home | Main Index | Thread Index
- Prev by Date: Sony Lovefest . . . . . (was Re: [tlug] Linux / MacOS X and dv cameras)
- Next by Date: Re: Sony Lovefest . . . . . (was Re: [tlug] Linux / MacOS X and dv cameras)
- Previous by thread: Re: [tlug] Re: Fwd: OOXML in Japan
- Next by thread: [tlug] [FOR SALE] USB 2.0 cables \100
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links