The thread of a parent process forks a child process. The child process inherits the scheduling policy and priority of the parent process. As with the parent thread, it is the child thread whose scheduling policy and priority will be used.
The following figure illustates the flow of creation.
- Each thread in a process is independently scheduled.
- Each thread contains its own scheduling policy and priority
- Thread scheduling policies and priorities may be assigned before a thread is created (in the threads attributes object) or set dynamically while a thread is running.
- Each thread may be bound directly to a CPU.
- Each thread may be suspended (and later resumed) by any thread within the process
The following scheduling attributes may be set in the threads attribute object. The newly created thread will contain these scheduling attributes:
contentionscope
PTHREAD_SCOPE_SYSTEM specifies a bound (1 x 1, kernel-spacel) thread. When a bound thread is created, both a user thread and a kernel-scheduled entity are created.
PTHREAD_SCOPE_PROCESS will specify an unbound (M x N, combination user- and kernel-space) thread. (Note, HP-UX release 10.30 does not support unbound threads.)
inheritsched PTHREAD_INHERIT_SCHED specifies that the created thread will inherit its scheduling values from the creating thread, instead of from the threads attribute object.
PTHREAD_EXPLICIT_SCHED specifies that the created thread will get its scheduling values from the threads attribute object.
schedpolicy
The scheduling policy of the newly created thread
schedparam
The scheduling parameter (priority) of the newly created thread.
TimeLine
A process and its thread change with the passage of time. A thread's priority is adjusted four key times, as shown in the next figure and described in the table that follows..
0 comments:
Post a Comment