*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> sched_setscheduler (3)              
Title
Content
Arch
Section
 

sched_setscheduler(3)

Contents


NAME    [Toc]    [Back]

       sched_setscheduler   -  Sets  the  scheduling  policy  and
       scheduling parameters of the specified process (P1003.1b)

SYNOPSIS    [Toc]    [Back]

       #include <sched.h>

       int sched_setscheduler (  pid_t  pid,  int  policy,  const
       struct sched_param *param);


LIBRARY    [Toc]    [Back]

       Realtime Library (librt.so, librt.a)

PARAMETERS    [Toc]    [Back]

       Specifies  the ID of the process for which scheduling policy
 and priority is  to  be  set.  If  pid  is  zero,  the
       scheduling policy and priority is set for the calling process.
   Specifies  the  scheduling  policy   to   be   set
       (SCHED_FIFO,   SCHED_RR,  or  SCHED_OTHER).   Specifies  a
       pointer to a sched_param  structure,  which  contains  the
       scheduling parameters of the specified process. Currently,
       the sched_param structure contains only a priority  field.
       The  value  of  priority  in the param structure indicates
       the priority level.

DESCRIPTION    [Toc]    [Back]

       The sched_setscheduler  function  changes  the  scheduling
       policy  and priority of a process. Changing the scheduling
       policy and priority ensures that an application can determine
 more effectively when a process will run.

       At run time, a process starts out with an initial priority
       of SCHED_PRIO_USER_MAX.  A call to either  the  sched_setparam
  or  sched_setscheduler  function can raise or lower
       the priority of a  process.  If  you  raise  the  priority
       higher than the initial priority, the new priority becomes
       the maximum for the process. This higher maximum  priority
       exists  for  the life of the process or until the priority
       is set to a new, higher priority through another  call  to
       the  sched_setparam  function. The maximum priority cannot
       be  adjusted  downward,  but  subsequent  calls   to   the
       sched_setparam or sched_setscheduler functions can specify
       that a process run at a lower priority.

       Three scheduling policies are supported: two  fixed-priority
  scheduling policies (SCHED_FIFO and SCHED_RR) and one
       timesharing policy (SCHED_OTHER).  Under a  fixed-priority
       scheduling  policy, only the user sets and adjusts process
       priorities. Under a  timesharing  scheduling  policy,  the
       scheduler  automatically  adjusts  priorities according to
       system resource usage and other factors.

       The scheduling policies supported by the  realtime  interface
 are as follows: Specifies a fixed-priority, first infirst
 out (FIFO) scheduling policy. Processes waiting at a
       specific  priority  level are selected from a process list
       that is ordered by the amount of time the  processes  have
       been  on  the  process list without being executed. Generally,
 the process at the head of the list has  waited  the
       longest  time;  the  process  at  the tail of the list has
       waited the  shortest  time.   Secifies  a  fixed-priority,
       round-robin (RR) scheduling policy. Processes waiting at a
       specific priority level are scheduled in much the same way
       as  for SCHED_FIFO,  scheduling with the additional condition
 that the length of time that a  process  executes  is
       subject  to a quantum.  Specifies the standard timesharing
       scheduling policy. Processes are  scheduled  in  much  the
       same  way as for the SCHED_FIFO scheduling policy with the
       additional condition that the  scheduler  adjusts  process
       priorities. Recalculation of process priorities results in
       preemption.

       Setting priorities in conjunction with a  FIFO  scheduling
       policy  allows  a critical process to run as soon as it is
       ready, for as long as it needs to  run,  because  it  will
       preempt  other, lower-priority processes. This behavior is
       important in situations where scheduling a process must be
       as fast and as precise as possible.

       Use  the sched_get_priority_max and sched_get_priority_min
       functions to determine  the  maximum  and  minimum  values
       allowed  for each scheduling policy. The value of the priority
 field in the sched_param  structure  pointed  to  by
       param  can  be  any integer within the inclusive range for
       the current scheduling policy, as  defined  in  <sched.h>.
       Higher numerical values for param represent higher priorities.


       The scheduling policy of a  process  is  inherited  across
       fork and exec calls.

       An  application  designed  for portability must initialize
       all fields of the sched_param structure before making  the
       function call.

       You   must   have   superuser   privileges   to  call  the
       sched_setscheduler function.

RETURN VALUES    [Toc]    [Back]

       On a successful call  to  sched_setscheduler,  the  former
       scheduling policy of the process is returned. On an unsuccessful
 call, a value of -1 is returned and errno  is  set
       to indicate that an error occurred and that the scheduling
       policy  and  parameters  of  the  specified  process   are
       unchanged.

ERRORS    [Toc]    [Back]

       The  sched_setscheduler function fails under the following
       conditions: An invalid value is specified for  the  policy
       argument  or  the  param  pointer is NULL.  The requesting
       process does not have permission to set either the  priority
 or the scheduling policy of the specified process.  No
       process can be found corresponding to  that  specified  by
       pid.

SEE ALSO    [Toc]    [Back]

      
      
       getpid(2),    sched_getparam(3),    sched_getscheduler(3),
       sched_setparam(3)

       Guide to Realtime Programming



                                            sched_setscheduler(3)
[ Back ]
 Similar pages
Name OS Title
sched_setparam Tru64 Sets the scheduling parameters of the specified process (P1003.1b)
sched_getscheduler Tru64 Returns the scheduling policy of a process (P1003.1b)
pthread_getschedparam Tru64 Obtains the current scheduling policy and scheduling parameters of a thread
sched_getparam Tru64 Returns the scheduling parameters of the specified process (P1003.1b)
pthread_setschedparam Tru64 Changes a thread's scheduling policy and scheduling parameters
sched_get_priority_min Tru64 Returns the maximum or minimum priority for the specified scheduling policy (P1003.1b)
sched_get_priority_max Tru64 Returns the maximum or minimum priority for the specified scheduling policy (P1003.1b)
sched_getscheduler FreeBSD set/get scheduling policy and scheduler parameters
sched_setscheduler FreeBSD set/get scheduling policy and scheduler parameters
pthread_attr_setschedparam Tru64 Changes the values of the parameters associated with a scheduling policy of the specified thread att...
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service