Hi all.. may i know the exact usage of getpriority() call used in linux.. even after searching thru net, i couldnt understand it exactly.. can someone explain it with an example.. thnx in advance :)
+1
A:
The scheduling priority of the process, process group, or user, as
indicated by which and who is obtained with the getpriority call ...
So, it returns a priority. It takes two args.
The first arg tells it how to interpret the second arg.
which is ... one of PRIO_PROCESS,
PRIO_PGRP, or PRIO_USER,
So, if which is PRIO_PROCESS, then 'who' is a process id, if it is PRIO_PGRP, it is a process group id, and if it is PRIO_USER, it is a user ID. A zero of who means the caller.
In the second two cases, the result is to select a set of processes, so it returns the lowest priority number of all of the selected processes.
bmargulies
2010-03-14 19:20:28
@bmargulies: thnx a lot.. so, i understand "getpriority(PRIO_PROCESS, 0) returns the nice value (static priority assigned to the process by the kernel) of the process, from which the above fn is invoked..
inquisitive
2010-03-14 19:32:10
@inquisitive Yup, that's my belief.
bmargulies
2010-03-14 19:33:30