LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-07-2010, 01:00 AM   #1
corone
Member
 
Registered: Jul 2009
Posts: 46

Rep: Reputation: 1
a question about Process Priority.


Code:
# ps
22355 pts/3    00:00:00 bash
#
# ps -l 22355
F S   UID   PID  PPID  C PRI  NI ADDR    SZ WCHAN  TTY        TIME CMD
0 S   519 22355 22354  0  75   0    -  1338 wait4  pts/3      0:00 -bash
#
# ps -o pid,priority,command 22355
PID   PRI  COMMAND
22355  15    -bash
#
Why are the priority values of the process different?
What is the difference?

Is the value 15 the "nice" priority?
Then, what is the value 75?

Please, explain the difference of each result.
Thank you.

Last edited by corone; 10-07-2010 at 01:03 AM.
 
Old 10-07-2010, 05:04 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The short answer is that there is a history of different *nix systems (and even different Linux kernels) having different priority systems.

The nice level is just a relative priority (-20..20), so it is mostly well behaved!

If you do the following, you will see several of these different priority systems:
Code:
ps -o pid,priority,pri,opri,nice,command
On a current Linux system, the value of pri equals 39-priority, and opri equals 60+priority.

The command top will give the 'priority'; ps -c will report 'pri', and ps -l will give 'opri'.

There are others too, and just to complicate matters, the kernel does not use the same scheduling algorithm for all processes.

Last edited by neonsignal; 10-07-2010 at 05:10 AM.
 
1 members found this post helpful.
Old 10-07-2010, 05:25 AM   #3
corone
Member
 
Registered: Jul 2009
Posts: 46

Original Poster
Rep: Reputation: 1
Thank you for your answer.

Thank you for your answer.
You really gave me great answer.

1 more question...
Code:
# ps -o pid,priority,nice,command
doesn't the 'priority' depend on the 'nice'?
 
Old 10-07-2010, 09:06 AM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Quote:
Originally Posted by corone View Post
1 more question...
doesn't the 'priority' depend on the 'nice'?
The priority of a process doesn't necessarily relate directly to the nice value; the nice value is just a way of advising the scheduler of a relative priority.

Having said that, on my systems priority equals nice+20, but that assumption is probably not portable.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to view the priority of the process abhinav4 Linux - Newbie 10 06-21-2010 08:24 AM
Static priority of a process. K-Z Programming 1 12-15-2009 01:19 AM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:47 AM.

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
Open Source Consulting | Domain Registration