HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
p
pthread(3T) pthread(3T)
(Pthread Library)
Stack
A stack is used by a thread to make function calls (and return from those calls), to pass arguments to a
function call, and to create the space for local variables when in that function call. Bound threads have a
user stack and a kernel stack. Unbound threads have only a user stack.
Synchronous Signal
A synchronous signal is a signal that has been generated due to some action of a specific thread. For exam-
ple, when a thread does a divide by zero, causes a floating point exception, or executes an illegal instruc-
tion, a signal is generated synchronously. Synchronous signals are delivered to the thread that caused the
signal to be sent.
Traditional Process
This is a single-threaded entity that can be scheduled to execute on a processor.
Thread
A thread is an independent flow of control within a process, composed of a context (which includes a regis-
ter set and program counter) and a sequence of instructions to execute.
Thread Local Storage (TLS)
Thread local storage is essentially thread-specific data requiring support from the compilers. With TLS, an
application can allocate the actual data as thread-specific data rather than using thread-specific data keys.
Additionally, TLS does not require the thread to make a function call to obtain thread-specific data. The
thread can access the data directly.
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.
HP-UX Release 11i: December 2000 − 13 − Section 3−−643
___
___