[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


A.3.2 Support for Real-Time Scheduling on Digital UNIX Systems

DECthreads supports Digital UNIX real-time scheduling. This allows you to set the scheduling policy and priority of threads. By default, threads are created using process contention scope. This means that the full range of 1003.1c-1995 scheduling policy and priority is available. However, threads running in process contention scope do not preempt lower priority threads in another process. For example, a thread in process contention scope with SCHED_FIFO policy and PRI_FIFO_MAX priority will not preempt a thread in another process running with SCHED_FIFO and PRI_FIFO_MIN.

"System Contention Scope" means that each thread created by the program has a direct and unique binding to one kernel execution context. A system contention scope thread competes against all threads in the system, and will preempt any thread with lower priority. For this reason, the priority range of threads in system contention scope are restricted unless running with root privilege. Specifically, a thread with SCHED_FIFO policy cannot run at a priority higher than 18 without privilege, since doing so could lock out all other users on the system until the thread blocked. Threads at any other scheduling policy (including SCHED_RR) may run at priority 19 because they are subject to periodic timeslicing by the system. For more information, see the Digital UNIX Realtime Programming Guide.

If your program lacks necessary privileges, attempting to call the following routines for a thread in system contention scope returns the error value EPERM:


pthread_attr_        (Error returned by pthread_create at thread creation)
setschedpolicy

pthread_attr_        (Error returned by pthread_create at thread creation)
setschedparam        

pthread_
setschedparam


Prior to Digital UNIX Version 4.0, all threads were System Contention Scope. In Digital UNIX Version 4.0, all threads created using DECthreads are in Process Contention Scope. In the future, the pthread_attr_setscope function will allow the programmer to select the desired contention scope for each thread created.


[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]