Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mpadvise(2) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hardclock(1M)

run(1)

rerun(1)

fork(2)

getpriority(2)

getquantum(2)

memadvise(2)

shmop(2)

mpadvise(2)  —  CX/UX

NAME

mpadvise − multiprocessor control

SYNOPSIS

#include <sys/time.h>
#include <sys/resource.h>

int mpadvise (cmd, which, who, mask)
int cmd, which, who, ∗mask;

DESCRIPTION

mpadvise performs a variety of functions in a multiprocessor system. 

CPUs are identified by integers in the range 0 to 31.  Collections of CPUs are depicted by a 32-bit mask where the value (1<<i) represents CPU i.  mpadvise reads and writes CPU masks through the mask parameter. 

The following commands get or set information about the CPUs in the system.  The which and who parameters must be zero. 

­MPA_CPU_ACTIVE Return a mask indicating which CPUs are active; that is, initialized and accepting work.  Through console processor commands, one may boot the system with fewer CPUs than actually exist in the backplane. 

­MPA_CPU_BOOT Return a mask indicating which CPU booted the system.  The "boot processor" has some responsibilities not shared with the other CPUs. 

­MPA_CPU_FPP Return a mask indicating which CPUs have floating point hardware. 

­MPA_CPU_GETHRDCLK Return a mask indicating which CPUs are servicing the hardclock interrupt. 

­MPA_CPU_SETHRDCLK Specify which CPUs are to service the hardclock interrupt.  This command is intended for use in a real-time environment only.  Refer to the CX/UX Programmer’s Guide for additional information.  Services normally performed by the hardclock interrupt routine will not occur on CPUs where handling is disabled.  These services include:

Accounting for process CPU usage and sending SIGXCPU
 
Expiring the process virtual interval timer and sending SIGVTALRM
 
Expiring the process profiling timer and sending SIGPROF
 
Aging process rescheduling locks and sending SIGRESCHED
 
Initiating process and kernel profiling functions
 
Accounting for process memory usage
 
Expiring process quantums.  A process will run until it blocks, is preempted by a higher priority process, forks, or exits.

Only the super-user or a user with the ACC_MPADVISE privilege can use this command.  Attempts to disable handling for the boot CPU or enable handling for CPUs which are not active will be silently ignored. 

The following commands get information about the CPUs in the system.  The meaning of the which and who parameters varies with each command. 

­MPA_CPU_LMEM Return a mask indicating which CPUs share a local memory pool with the CPU specified in the who parameter.  Which must be zero; who is a CPU mask with exactly one bit set.  If the specified CPU does not have access to a local memory pool, then the returned mask will be zero.  As a special case, if who is 0, a mask of all the CPUs possessing local memory is returned. 

­MPA_CPU_INTVEC Return a mask indicating which CPUs are assigned to the non-VME interrupt vector specified in the who parameter.  Which must be zero.  If exactly one bit is set in the mask, the interrupt is assigned to the corresponding CPU.  If more than one bit is set, then more than one CPU may receive its own unique interrupt through the specified interrupt vector, or the interrupt may float between CPUs. 

­MPA_CPU_VMELEV Return a mask indicating which CPUs are assigned to the VME interrupt level (1-7) specified in the who parameter.  Which identifies the I/O bus: MPA_VMELEV_PRIMARY for primary and MPA_VMELEV_SECONDARY for secondary bus.  If exactly one bit is set in the mask, the interrupt is assigned to the corresponding CPU.  If more than one bit is set, the interrupt may float between CPUs. 

For more information on CPU interrupt assignments and on local memory, refer to the appropriate Architecture Reference Manual.

Each process possesses a mask, a CPU "bias", restricting its use of processors.  A process may not run on a CPU not present in its mask, and if more than one CPU is specified, the kernel is free to migrate the process based on load and other considerations.  Each process inherits its CPU bias from its parent during a fork(2), but may thereafter change it.  Init(1M) is initially given a mask that includes all the processors in the system, but this may be changed before entering multi-user mode with an invocation of rerun(1) in /etc/inittab. 

The following commands provide control over a process’s, process group’s, or user’s use of CPUs.  Which is one of

PRIO_PROCESSprocess id
PRIO_PGRPprocess group id
PRIO_USERuser id

and who is interpreted relative to which: a process identifier for PRIO_PROCESS, a process group identifier for PRIO_PGRP, and a user ID for PRIO_USER.  A value of 0 for who refers to the calling process’s identifier, group identifier, or user ID. 

­MPA_PRC_GETBIAS Return the logical sum of the biases of all the specified processes. 

­MPA_PRC_SETBIAS Sets the CPU bias of all the specified processes to ∗mask.  Only the super-user or a user with the ACC_MPADVISE privilege can add a CPU to a bias. 

­MPA_PRC_GETRUN Return the logical sum of the current CPU assignments of all the specified processes. 

­MPA_PRC_SETRUN Sets the CPU assignment of all the specified processes to ∗mask (exactly one bit must be set).  The CPU must be included in each process’s bias.  Only the super-user or a user with the ACC_MPADVISE privilege can change a process’s CPU assignment. 

mpadvise will fail if any of the following are true:

­[EINVAL] Which or cmd were not one of the values documented above. 

­[EINVAL] A CPU bias or run mask is zero, or a run mask has more than one bit set. 

­[EINVAL] A CPU bias or run mask was specified for a processor with no local memory and the specified process(es) have hard local memory bindings. 

­[EINVAL] A CPU bias or run mask was specified that requires process migration and the specified process(es) are attached to a shared memory region that is bound to a local memory pool that is foreign to one or more of the CPUs in the bias or run mask.  A process may override this restriction with a special shmat(2) option.  See the shmop(2) man page for more information. 

­[ESRCH] No process(es) were located using the which and who values specified. 

­[EACCESS] A process was located, but neither its effective nor real user ID matched the effective user ID of the caller. 

­[EACCESS] The caller did not have sufficient privilege to add a processor to a CPU bias, or change a CPU assignment, or use the MPA_CPU_SETHRDCLK command.  These operations require that the caller either be the super-user or a user with the ACC_MPADVISE privilege (if access vectors are configured). 

­[EFAULT] The address specified for mask is invalid. 

RETURN VALUE

Upon successful completion, the number of bits set in ∗mask is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

SEE ALSO

hardclock(1M), run(1), rerun(1). 
fork(2), getpriority(2), getquantum(2), memadvise(2), shmop(2). 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026