Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ schedctl(2) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

npri(1)

nice(2)

prctl(2)

sched_getparam(2)

sched_setparam(2)

sched_getscheduler(2)

sched_yield(2)

sched_get_priority_max(2)

sched_get_priority_min(2)

sched_rr_get_interval(2)

sproc(2)

sysmp(2)



schedctl(2)                                                        schedctl(2)



NAME
     schedctl - scheduler control call

C SYNOPSIS
     #include <limits.h>
     #include <sys/types.h>
     #include <sys/prctl.h>
     #include <sys/schedctl.h>

int schedctl (int cmd, [ int arg1 [ , int arg2 ] ]);
DESCRIPTION
This system call is used to alter scheduling parameters of either
individual processes or of the system as a whole. The following commands
are supported:
AFFINITYON
This command enables cache affinity for the calling or another
process. arg1 is the process ID of the process to be modified;
if zero, it indicates the current process. The affinity status
is inherited by the process's children after a fork. By default,
affinity is on.
AFFINITYOFF
This command disables cache affinity for the calling or another
process. arg1 is the process ID of the process to be modified;
if zero, it indicates the current process. The affinity status
is inherited by the process's children after a fork.
AFFINITYSTATUS
This command returns the current cache affinity status for the
calling or another process. arg1 is the process ID of the
process to be modified; if zero, it indicates the current
process. If affinity is on, it returns 0, otherwise 1.
RENICE This command allows a process to change its own or another
process's nice value. arg1 is the process ID of the process to
be modified; if zero, it indicates the current process. arg2 is
the new process nice value to use. This is different than the
value given to the nice(2) system call. nice takes a relative
value, while this command changes the absolute nice value of the
process which ranges from 0 to 39. The default absolute nice
value for a process is 20.
The process must have superuser permissions to use this command.
The previous (absolute) nice value is returned.
SLICE This command allows a process to change its own or another
process's time slice. A time slice is the period of time that a
process is allowed to run before being eligible for preemption by
another process. arg1 is the process ID of the process to be
altered; if zero, it indicates the current process. arg2 is the
new time slice value to use, expressed in terms of clock ticks.
Page 1


schedctl(2)                                                        schedctl(2)



             The system software clock fires CLKTCK times per second; hence
             the duration of a clock tick in milliseconds is equal to
             1000/CLKTCK (see <limits.h>).  arg2 is constrained to be greater
             than 0, and less than 10 seconds.

             The process must have superuser permissions to use this command.
             The previous time slice value is returned.

     SETHINTS
             This command sets up a communication path between the process and
             the kernel, which allows the process to communicate scheduling
             modes to the kernel without the overhead of a system call.  The
             return value is a pointer to a prda_sys structure, defined in
             <sys/prctl.h>.  Since the return value for schedctl is defined as
             an integer, it is necessary to cast this value to a struct
             prdasys * before using it.  Also, since the optimizer can remove
             references to variables which have no apparent uses, it is best
             to declare the variable with the volatile attribute:

             volatile struct prdasys *prdasys;

             After a SETHINTS command, the process may write scheduling modes
             to the t_hint field of the prda_sys structure.  These scheduling
             modes will be observed by the kernel at process dispatch time.
             The scheduling modes are the same as those defined for the
             SCHEDMODE command.

             Also, the t_cpu field may be read by user code to obtain the
             identifier of the cpu where the process was recently scheduled.

     The next two commands provide control over the scheduling of groups of
     parallel processes on multi-cpu systems.  The processes must be members
     of the same sharegroup (see sproc(2) for more information about share
     groups).  Note that the SCHEDMODE and SETMASTER commands can only be used
     after a share group has been created.

     SCHEDMODE
             This command allows a member of a share group to set a scheduling
             mode for the entire share group.  arg1 specifies the scheduling
             mode.  These are SGSFREE, which specifies that each member of
             the share group is to be scheduled independently, SGSSINGLE,
             which specifies that only the master is to run (see SETMASTER for
             setting the master thread), and SGSGANG, which specifies that
             all members of the share group are to be scheduled as a unit, if
             possible.  The default scheduling mode when a share group is
             created is SGSFREE.

             The previous scheduling mode is returned.

     SETMASTER
             This command sets the master process of the share group.  arg1
             specifies the pid of the new master process.



                                                                        Page 2





schedctl(2)                                                        schedctl(2)



             By default, the creator of the share group is the master process.
             The master process differs from other members of the share group
             only in the case of the SGSSINGLE scheduling mode.  In that
             case, only the master process will run.  This operation can only
             be performed by the master of the share group.  On success, 0 is
             returned.

     <sys/schedctl.h>.

     schedctl will fail if any of the following are true:

     [EINVAL]    An invalid command or new value was passed to the system.

     [EINVAL]    The command was SCHEDMODE, and either the process was not a
                 member of a share group, or arg1 did not specify a valid
                 scheduling mode.

     [EINVAL]    The command was SETMASTER, and either the process was not a
                 member of a share group, the process was not the current
                 master of the share group, or arg1 specified a process that
                 was not a member of the share group.

     [EPERM]     An attempt was made to perform privileged operations without
                 appropriate permissions.

     [ESRCH]     The named process was not found.

SEE ALSO
     npri(1), nice(2), prctl(2), sched_getparam(2), sched_setparam(2),
     sched_getscheduler(2), sched_yield(2), sched_get_priority_max(2),
     sched_get_priority_min(2), sched_rr_get_interval(2), sproc(2), sysmp(2)

DIAGNOSTICS
     schedctl returns -1 if an error occurred.  Otherwise, the return is
     dependent on cmd.




















                                                                        Page 3



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