pfuProcessManager(3pf) OpenGL Performer 3.2.2 libpfutil C++ Reference Pages
NAME
pfuProcessManager, pfuDefaultProcessManager, pfuFreeAllCPUs - Priority,
processes and processor assignment functions
FUNCTION SPECIFICATION
#include <Performer/pfutil/pfuProcessManager.h>
static void -
pfuProcessManager::select(pfuBaseProcessManager *);
static void pfuProcessManager::setMode(int mode,
int val);
static int pfuProcessManager::setMode(int mode);
void -
pfuProcessManager::setCreateFunc(pfuProcessHandlerFuncType func,
uint mask);
void -
pfuProcessManager::getCreateFunc(pfuProcessHandlerFuncType *func,
uint *mask);
void -
pfuProcessManager::setPlaceFunc(pfuProcessHandlerFuncType func,
uint mask);
void -
pfuProcessManager::getPlaceFunc(pfuProcessHandlerFuncType *func,
uint *mask);
void -
pfuProcessManager::setPrioritizeFunc(pfuProcessHandlerFuncType func,
uint mask);
void -
pfuProcessManager::getPrioritizeFunc(pfuProcessHandlerFuncType *func,
uint *mask);
static void pfuProcessManager::reconfigure(void);
static void pfuProcessManager::release(void);
static pfuBaseProcessManager * pfuProcessManager::getCur(void);
static void pfuDefaultProcessManager::init(void);
int pfuFreeAllCPUs(void);
typedef int (*pfuProcessHandlerFuncType)(int _pipe,
uint _stage, pid_t _pid);
Page 1
pfuProcessManager(3pf) OpenGL Performer 3.2.2 libpfutil C++ Reference Pages
DESCRIPTION
The pfuProcessManager class hierarchy implements an extensible process
manager framework bsed on the pfuBaseProcessManager class with a default
process manager class, pfuDefaultProcessManger. The currently active
process manager can be communicated with via the pfuProcessManager global
routines.
pfuProcessManager::select will select the current process manager.
pfuProcessManager::getCur will return a pointer to the current process
manager.
pfuProcessManager::setMode will set the specified mode for the currently
active process manager to the given value, val. The modes and associated
values are to be supported by all process managers are:
PFUPM_CONTINUOUS takes a boolean value to indicate
continuous operation and placement of new
processes, or if explicit calls to
reconfigure the process manager need to be
made to trigger process control.
PFUPM_LOCK_DOWN takes a boolean value to indicate if
locking of processes to processors and
potential isolation of those processors
should occur. The default value is FALSE.
PFUPM_PRIORITIES takes a boolean value to indicate if
processes should be given non-degrading
priorties. The default value is FALSE.
pfuProcessManager::getMode will return the current value of mode for the
currently active process manager.
pfuProcessManager::reconfigure will force the current process manager to
do a replacement of all registered processes according to the current
mode settings.
pfuProcessManager::release will force the release of isolated CPUs and
processes registered with the current process manager. Processes will
have non-degrading priorties removed and will be allowed to run on any
CPU.
pfuDefaultProcessManager::init will create and select a process manager
with a default policy. The pfuDefaultProcessManger uses the
pfCreateProcessFunc API to register a callback function with libpf that
will be called upone the creation of any OpenGL Performer process.
pfuGetProcessMiscCPU is used to determine which CPU is to be considered
the non-real-time miscellaneous CPU (typically CPU 0). The
pfuDefaultProcessManger will place Performer processes onto processors
and set non-degrading priorities on critical processes as described
below. The routines implementing these features utilize the IRIX REACT
facilities. Refer to the IRIX REACT technical report, and the sysmp(2)
and realtime(5) man pages for detailed information on these concepts.
Page 2
pfuProcessManager(3pf) OpenGL Performer 3.2.2 libpfutil C++ Reference Pages
The policy implemented by the pfuDefaultProcessManager is: 1. First, if
there are sufficient CPUs, each of APP, CULL and DRAW gets its own
processor and no critical path processes are placed on the Misc CPU. If
not, the APP is placed on CPU 0 which which will not be isolated. If
there are still not enough processors, cull and draw processes (if
separate) of a given pfPipe are paired to run on the same CPU. If there
are still not sufficient CPUs, extra cull and draw processes will be
placed on the last CPU. 2. Next, the LPOINT process(es) are given their
own CPUs if there are enough available CPUs. Otherwise, they will be
given the last CPU. 3. Next, ISECT and COMPUTE processes are given their
CPUs or paired if there is one additional CPU or else given the MISC CPU.
4. Finally, the DBASE and QUEUE process(es) are given their own CPUs or
paired if there is one additional CPU or else given the MISC CPU.
Multipipe mappings are as follows.
If NumCPUs >= 2 + 2*NumPipes
then each cull and draw process can have its own CPU and are placed together
on a CPU node. The application is placed on CPU 1 with UNIX getting CPU 0.
If NumCPUs == 1 + 2*NumPipes
then the application shares CPU 0 with UNIX.
Otherwise, if NumCPUs >= 2 + NumPipes
then cull and draw processes for each pipe are paired together.
The LPoint processes are also given their own CPUs if there are enough
available CPUs. Otherwise, they are grouped together on a single CPU,
their own if there is on extra, else the last CPU.
The pfuProcessManager provides 2 mechanisms of extensibility: C++
subclassing and C callbacks. The pfuBaseProcessManager and
pfuDefaultProcessManager can both be subclassed and new instances can be
made the current process manager. In addition, custom user callbacks can
be assigned to hand specific types of processes defined by the PFU_PROC_*
mask or unknown processes.
pfuProcessManager::setCreateFunc sets a custom user callback for handling
the creation of new processes. The return value should be PFU_CB_CONT if
the user has decided to let the pfuProcessManager handle the function and
PFU_CB_TERM if the user has processed it. The current user function and
associated mask is gotten with pfuProcessManager::getCreateFunc.
pfuProcessManager::setPlaceFunc sets a custom user callback for handling
the processor placement of new processes. The placement function should
return the chosen CPU number or (-1) if the user has choosen to not
handle the process. The cpu placement will be done upon the explicit or
automatic call by the process manager to place processes.
pfuProcessManager::getPlaceFunc will return the current user placement
function and process mask.
Page 3
pfuProcessManager(3pf) OpenGL Performer 3.2.2 libpfutil C++ Reference Pages
pfuProcessManager::setPrioritizeFunc sets a custom user callback for
handling the processor prioritization of new processes. The function
should return the chosen priority relative to the app process or
PFUMP_NOPRI if the user has choosen to not handle the process. The
process priority will be set upon the explicit or automatic call by the
process manager to place processes. pfuProcessManager::getPrioritizeFunc
will return the current user prioritization function and process mask.
The following example is taken from the sample application source code
provided in c/usr/share/Performer/src/sample/C++/common/main.C:
/* Initialization and start of pfuProcess Manager */
pfuInitDefaultProcessManager;
.....
//
// Configure OpenGL Performer and fork extra processes if
// configured for multiprocessing.
//
pfConfig();
// Tell ProcessManager to configure the system
pfuProcessManagerMode(PFUPM_CONTINUOUS, 1);
pfuProcessManagerMode(PFUPM_LOCK_DOWN, 1);
pfuProcessManagerMode(PFUPM_PRIORITIES, 1);
pfuReconfigureProcessManager;
// Initialization of pfuProcess Manager
pfuDefaultProcessManager::init();
.....
//
// Configure OpenGL Performer and fork extra processes if
// configured for multiprocessing.
//
pfConfig();
// Tell ProcessManager to configure the system
pfuProcessManager::setMode(PFUPM_CONTINUOUS, 1);
pfuProcessManager::setMode(PFUPM_LOCK_DOWN, 1);
pfuProcessManager::setMode(PFUPM_PRIORITIES, 1);
pfuProcessManager::reconfigure();
NOTES
CPU isolation or restriction functionality is not currently supported
under Linux.
Isolating a CPU to run specific processes requires super-user permission.
Setting non-degrading priorities on processes requires super-user
permission.
CPU 0 should never be isolated.
Page 4
pfuProcessManager(3pf) OpenGL Performer 3.2.2 libpfutil C++ Reference Pages
A utility shell script is provided in
/usr/share/Performer/src/tools/freeproc that can be run as super-user to
clean up after a program that exits ungracefully.
The libpfutil source code, object code and documentation are provided as
unsupported software. Routines are subject to change in future releases.
SEE ALSO
pfConfig, pfConfigStage, pfCreateProcessFunc, pfuGetProcessMiscCPU,
realtime, sysmp, schedctl, sched_setscheduler
Page 5