HP-UX Reference (11i v1 05/09) - 3 Library Functions N-Z (vol 7)
p
pthread(3T) pthread(3T)
(Pthread Library)
Thread-Safe Function
A thread-safe function is one that may be safely called by multiple threads at the same time. If the function
accesses shared data or resources, this access is regulated by a mutex or some other form of synchroniza-
tion.
Thread-Specific Data (TSD)
Thread-specific data is global data that is specific to a thread. All threads access the same data variable.
However, each thread has its own thread-specific value associated with this variable. errno is an example of
thread-specific data.
Thread Structure
The operating system maintains a thread structure for each thread in the system. This structure represents
the actual thread internally in the system. A sample of thread structure information includes the thread
ID, the scheduling policy and priority, and the signal mask. The thread structure and the values contained
within it are part of the context of a thread.
User Mode
A mode of operation where a subset of operations are allowed. While a thread is executing an applications
code, it is executing in user mode. When the thread makes a system call, it changes modes and executes in
kernel mode until the system call completes.
User Space
The user code exists in this space. User code is executed in this space at the normal privilege level. In gen-
eral, there are two privilege levels: one for user code (user mode) and the other for kernel code (kernel
mode).
User Stack
When a thread is executing code in user space, it needs to use a stack to make function calls, pass parame-
ters, and create local variables. While in user mode, a thread does not use the kernel stack. Instead, a
separate user stack is allocated for use by each user thread. See Stack for a generic description of a stack.
User Thread
When pthread_create()
is called, a user thread is created. Whether a kernel-scheduled entity (kernel
thread or lightweight process) is also created depends on the user thread’s scheduling contention scope.
When a bound thread is created, both a user thread and a kernel-scheduled entity are created. When an
unbound thread is created, generally only a user thread is created. See Thread for a generic description of a
thread.
SEE ALSO
thread_safety(5).
ThreadTime by Scott J. Norton and Mark D. DiPasquale, Prentice-Hall, ISBN 0-13-190067-6, 1996.
Section 3−−678 Hewlett-Packard Company − 12 − HP-UX 11i Version 1: September 2005