Threads Module User's Guide : PART II Concurrency Packages : Chapter 3 The Threading Package : Thread Attributes : Thread Attribute Families
Thread Attribute Families
The thread attributes supported by the Threading package can be divided into two families: thread scheduling attributes and thread stack management attributes.
Scheduling Attributes
The scheduling attributes include:
Start Policy — Indicates whether or not the newly created thread should be left in the interrupted state upon returning from start(). Threads created by a call to start() are always interrupted immediately after creation and then released before start() returns to its caller. This thread can be released from the interrupt at some later time by calling the runnable’s releaseInterrupt() member.
Contention Scope — Defines whether a thread is to contend for processing resources relative to other threads within the same process or relative to other threads within the same system.
Scheduling Inheritance Policy — Defines whether the scheduling attributes for scheduling policy, priority, and time-slice quantum should be taken from the thread attribute object or whether they should be inherited from the creating thread.
Concurrency Policy — Requests concurrent execution for a new thread. Typically such a request results in the creation of a new kernel-level thread to support parallel (separate processors) or time-sliced execution of a new user-level thread.
Scheduling Policy — Identifies the scheduling policy to use for deciding which threads should be executed on which processors, when these threads should be run, and how long the threads should be run. Each scheduling policy can define additional attributes that can be used to control specific aspects of that policy, such as priority value, concurrency policy, or time-slice quantum.
Scheduling Priority — Defines a numerical rank or ordering to use in resolving thread contention for processing resources. In the Threading package, threads with numerically higher priority values receive scheduling preference over threads with lower priorities. The legal range of priority values tends to vary significantly between thread APIs and even between scheduling policies. Some platforms, such as Solaris, require the use of two separate priority values for threads with system contention scope. One value sets the system-level scheduling priority for the thread, and the second value prioritizes access to any thread-level synchronization resources shared with other threads in the same process.
Time-slice Quantum — Under a time-sliced scheduling policy, this attribute defines the maximum amount of time that a thread is allowed to run before scheduling the next eligible thread to run. Some systems allow a separate quantum value to be defined for each thread, while others can apply the same quantum to all threads within a scheduling class, process, or system.
For more information on these attributes, see “Scheduling Attributes.”
Stack Management Attributes
The stack allocation attributes define one of two different stack management policies, either system-managed or user-managed.
If the system allocates and manages a thread’s stack, the two significant attributes are:
Stack Reserve Size — The amount of virtual address space to reserve for the stack.
Stack Commit Size — The amount of physical memory and pagefile space to initially commit to the stack.
If the user application allocates and manages a thread’s stack, the relevant attributes include:
User Stack Address — The lowest address or bottom of the stack address space reserved, allocated, and managed by the user.
User Stack Size — The memory space size of the user-allocated stack. Locates the top of the stack address space where the bottom of the stack is typically located (for stacks that grow downward in memory).
For more information on these attributes, see “Stack Attributes.”