1834168 Members
2335 Online
110064 Solutions
New Discussion

process priority

 
SOLVED
Go to solution
Marc Ahrendt
Super Advisor

process priority

how is the priority assigned to a process?
i know about nice/renice
i know some programs have a "-p" option
i DO NOT know how to start frog.ksh at priority 183 ...either as root a a general user
hola
5 REPLIES 5
Jim Marsden
Occasional Advisor

Re: process priority

On HP-UX systems, the priority of a process is set by the scheduler (unless the process is running at a real-time priority, i.e. started with rtprio).

The scheduler works by setting an initial priority to a process (based on whether it is a system or user process etc.) and then places the process on the run queue. Each process on the run queue receives a certain number of CPU "timeslices" depending on thier relative priorities.

Whilst a process is running (i.e. it has CPU time), its priority is degraded. At the same time, the priorities of non running processes are increased. When another non process has a higher priority than a running process, the scheduler will give the higher priority process CPU time.

Basically nice and renice control the "rate" at which process priorities are degraded or increased as opposed to explicitly setting the priority.

Also, using nice has different effects depending on which shell you are running; if you run nice from sh or ksh it will execute /usr/bin/nice which will lower priorities by 10 each timeslice. If you run from csh, it will execute it's built in nice and lower priorites by 4 each timeslice.
There are ten kinds of people in this world, those that understand binary - and those that don't.
Ravi_8
Honored Contributor

Re: process priority

hi,
you can't set the priority to 183 the lowest value of priority is 39.even if you colud set the priority to 183, processes will be running at the priority value of 39.


An unsigned value increases the system nice value for command, causing it to run at lower priority. A negative value requires superuser privileges, and assigns a lower system nice value (higher priority) to command. If the current process is not privileged, the value is silently treated as if it were 0.

If the value of priority_change would result in a
system nice value outside the range 0 through 39,
the corresponding limit value of 0 or 39 is used
instead.
never give up
Marc Ahrendt
Super Advisor

Re: process priority

ravi, i was asking about a priority of 183 not a nice value of 183

jim, how does the scheduler after determining frog.ksh is a user process then actually give it a priority number (because doesn't the allowed user process priority range from 178 to 251) ...is there some configuration file or rules used? why would it not give it 183 instead of 193, etc...?
hola
Shahul
Esteemed Contributor

Re: process priority

Hi

Priorities are assigned by default. If U want to assign some other priority, U will have to use nice command while executing the program. See the example below

#nice -n -5 sam

After starting the process If U want to change the priority, Use renice command.. See example

#renice -n -5 "process ID"

Best of luck

Shahul
Wodisch
Honored Contributor
Solution

Re: process priority

Hello Marc,

priorities of Time-Sharing processes (128-251) are
"aging", which means the scheduler is changing them;
every time the process does NOT get a CPU when a
process switch happens, its priority is numerically
decreased (which means, the priority is raised ;-),
until it is so high prioritized that it gets a CPU. Then its
priority is reset to the original (and hence lower) one.
POSIX and Real-Time priorities are set with the
appropriate commands, but Time-Sharing priorities are
set by inheritance from the parent processes, or with
the system call "sched_setparam(2)".

HTH,
Wodisch