LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2010, 10:27 AM   #1
abhinav4
Member
 
Registered: Jun 2010
Location: India
Distribution: Fedora/Cent OS
Posts: 123

Rep: Reputation: 0
How to view the priority of the process


How to view the priority (-20 to 19) of the process in fedora/redhat.
 
Old 06-18-2010, 10:42 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,822

Rep: Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610
ps or top
 
Old 06-18-2010, 11:27 AM   #3
abhinav4
Member
 
Registered: Jun 2010
Location: India
Distribution: Fedora/Cent OS
Posts: 123

Original Poster
Rep: Reputation: 0
I want to check the priority of vsftpd. when i use top, it does not show up vsftpd in the list.
 
Old 06-18-2010, 11:37 AM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,822

Rep: Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610
Reverse sort by process name
 
Old 06-18-2010, 11:53 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Quote:
Originally Posted by AlucardZero View Post
Reverse sort by process name
For a single PID "3020" try '/bin/ps --no-headers -p 3020 -o pid,nice' (which is different from "-o pri,rtprio,priority") or 'procstat -t 3020'. If you `pgrep vsftpd` then you just '/bin/ps --no-headers -p $(pgrep vsftpd) -o pid,nice' or to be safe 'pgrep vsftpd|xargs -iP /bin/ps --no-headers -p 'P' -o pid,nice'...
 
Old 06-18-2010, 12:02 PM   #6
Fabio Paolini
Member
 
Registered: Dec 2008
Location: Brazil
Distribution: Slackware 12 Debian 5
Posts: 52

Rep: Reputation: 17
Using ps, you can run
Code:
ps -eo user,pid,nice,pri,command
If I want to see a command called /usr/bin/X, for example, in my system:
Code:
ps -eo user,pid,nice,pri,command |grep /usr/bin/X
root      2921   0 19 /usr/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
Of course there are many other options to use in 'ps'.See "man ps".
A hard thing about ps is that it has 2 or 3 different syntaxes

Last edited by Fabio Paolini; 06-18-2010 at 12:07 PM.
 
Old 06-18-2010, 12:07 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Quote:
Originally Posted by Fabio Paolini View Post
there are many other options to use in 'ps'.
...like I already posted. Plus mine's more efficient.
 
Old 06-18-2010, 01:20 PM   #8
Fabio Paolini
Member
 
Registered: Dec 2008
Location: Brazil
Distribution: Slackware 12 Debian 5
Posts: 52

Rep: Reputation: 17
Quote:
quote unSpawn ..like I already posted. Plus mine's more efficient.
Probably the your is best. When I open my post reply window the your was not yet posted.

Now, just to solve a doubt. What is the difference between nice and priority? I see (using top) that they are not the opposite of each other.
Thanks.
 
Old 06-19-2010, 03:14 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
Quote:
Originally Posted by Fabio Paolini View Post
What is the difference between nice and priority? I see (using top) that they are not the opposite of each other.
Executive overview: nice: your call, rtprio: your call, priority: can't touch this.

Slightly more verbose: in 'man 5 proc' at the /proc/[number]/stat field explanation priority is described as "The standard nice value, plus fifteen." and nice as "The nice value ranges from 19 (nicest) to -19 (not nice to others).". If you run '/bin/ps axf -eo pid,pri,nice,rtprio,comm --sort=pid' "PRI" means the kernel the "real" priority value the kernel uses to schedule process runtime (lowest value 0 means highest priority and there's 140 run queues AFAIK), NI is a modifier (setpriority()) and RTPRIO too (any SCHED_.* as in 'man chrt'). If I translate correctly (please correct me if I'm wrong) what I've read then the actual priority PRI value is a value the kernel scheduler sets (which you can't change) and RTPRIO tells it what dynamic priority adjustment it should apply and NI how quick it should adjust priority. There's a lot of man pages on the subject, also see the historical http://tldp.org/LDP/lki/lki-2.html document, Robert Love's texts, http://www.ibm.com/developerworks/li...y/l-scheduler/, the "Understanding the Linux Kernel" (e-)book, http://kerneltrap.org/node/11778 and http://kerneltrap.org/scheduler.

Last edited by unSpawn; 06-19-2010 at 03:15 AM.
 
Old 06-21-2010, 08:17 AM   #10
Fabio Paolini
Member
 
Registered: Dec 2008
Location: Brazil
Distribution: Slackware 12 Debian 5
Posts: 52

Rep: Reputation: 17
Thanks,unSpawn. I took some time to understand your answer. Now I understand it better. I'm reading your references too, but this
http://tldp.org/LDP/lki/lki-2.html is particularly hard.
 
Old 06-21-2010, 08:24 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
I'd say well done for even trying!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 10:22 AM
Problem about process priority gunp66 Programming 9 05-16-2005 09:14 AM
What's the default priority of a process? Nerox Programming 2 04-08-2005 11:13 AM
Change process priority ]SK[ Linux - Software 11 02-24-2005 08:00 PM
high priority process? gongli Slackware 5 08-08-2003 01:03 PM


All times are GMT -5. The time now is 03:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration