[Prev] [Contents] [Next]

Important Pthread Definitions

A

Attribute Object
Any of the pthreads data structures which are used to specify the initial states when creating certain resources (threads, mutexes, and condition variables). To create a thread, you can use a thread attribute object. To create a mutex, you use a mutex attributes object. To create a condition, you can use a condition attributes object. Functions that create attribute objects are pthread_attr_init(), pthread_mutexattr_init(), pthread_condattr_init().

C

Cancel
As in a `cancel' is delivered to a thread when pthread_cancel() is issued. A cancel can be held pending if the target thread has cancelation DISABLED or DEFERRED. The cancel may be acted upon when cancelation is set to ENABLED or ASYNCHRONOUS.
Cancelation Cleanup Handler
A function registered to perform some cleanup action. Cancelation Cleanup Handlers are called if a thread calls pthread_exit() or is the target of a pthread_cancel(). Cancelation cleanup handlers are `stacked' onto a `cancelation cleanup stack' and can be pushed and popped using the pthread_cleanup_push() and pthread_cleanup_pop() functions.
Cancelation Point
A function that causes a pending `Cancel' to be delivered if the `Cancelation State' is ENABLED, and the `Cancelation Type' is DEFERRED. pthread_testcancel() can be used to create a cancelation point. For a list of other functions that are cancelation points, see pthread_cancel().
Cancelation State
One of two values (ENABLED or DISABLED) describes whether cancels in the current thread are acted upon or held pending, If ENABLED, the cancelation is acted upon immediately based on the current cancelation type. If DISABLED, the cancel is held pending until it is ENABLED. The cancelation state can be modified using the pthread_setcancelstate() function.
Cancelation Type
One of two values (DEFERRED or ASYNCHRONOUS) describes how cancels are acted upon in the current thread when the cancelation state is ENABLED. If DEFERRED, the cancel is held pending, if ASYNCHRONOUS, the cancel is acted upon immediately, thus ending the thread with a status of PTHREAD_CANCELED. The cancelation type can be modified using the pthread_setcanceltype() function.
Condition Variable
An abstraction that allows a thread to wait for some event to occur. The condition variable is used with a boolean predicate indicating the presence or absence of the event, and a mutex that protects both the predicate and the resources associated with the event. The condition variable has no ownership associated with it. See pthread_cond_init(), and other functions whose names begin with `pthread_cond_'.

D

Detach a thread
Mark a thread so that the system reclaims the thread resources when the thread terminates. If the thread is already terminated, the resources are freed immediately. After a threads resources are freed, the exit status is no longer available, and the thread cannot be detached or joined to. Use the pthread_attr_setdetachstate(), or pthread_detach() functions to detach a thread, or the pthread_join() function to wait for and then detach a thread.

E

Exit Status
The return value from a thread. A variable of type `void *' which typically contains some pointer to a control block pointer or return value that shows under what conditions the thread ended. The thread can be ended and the exit status can be set by returning from the thread start routine, by calling pthread_exit() or by canceling a thread using pthread_cancel().

G

Global Mutex
A single process global mutex is provided by the pthreads library to allow easy serialization to application resources. See the functions pthread_lock_global_np() or pthread_unlock_global_np().

I

Initial thread
The thread that is started automatically by the system when a job or process is started. Every job has at least 1 thread. That thread is often referred to as the initial thread or the primary thread. Threads other than the initial thread are referred to as secondary threads. The initial thread is special in that if the initial thread terminates, it causes all secondary threads and the job to terminate. See also `Secondary thread'.

J

Join to a thread
Wait for a thread to complete, detach the thread, and optionally return its exit status. Use pthread_join() to wait for a thread to complete.

N

Named Mutex
A named mutex is a mutex that has a text name associated with it for identification and debug purposes. The name is used in some system dumps and debug or thread management user interfaces. The name does not effect the behavior of the mutex, only the ability to debug the use of that mutex. The Pthread run-time names all mutexes by default. See the functions pthread_mutexattr_setname_np() or pthread_mutexattr_getname_np().

O

Orphaned Mutex
A mutex that was held by a thread when that thread terminated. It is expected that any application data or resources associated with the resources are most likely in an inconsistent state if a mutex is orphaned. An orphaned mutex is not available to be locked by another thread, and will cause a locking thread to block indefinitely or to get the EBUSY error when attempting to trylock the mutex.

M

Main thread
See `Initial thread'
Multi-Thread Capable
This term is AS/400 specific. See `Thread Capable'.
Multi-Threaded
A process that has multiple active threads. In the AS/400 documentation, the statement multi-threaded is sometimes used with the same meaning as `multi-thread capable'.
Mutex
An abstraction that allows two or more threads to co-operate in a MUTual EXclusion protocol that allows safe access to a shared resources. See pthread_mutex_init() or other functions whose names begin with `pthread_mutex_'. Also see `Recursive Mutex', `Named Mutex', `Global Mutex'.

P

Posix thread handle
The pthread_t data type that is returned to a creator of a posix thread. The pthread_t represents an opaque handle to the posix thread, it should not be modified except through the use of the pthread functions. The pthread_create() or pthread_self() function returns the posix thread handle. The pthread_equal() function can be used to see if two handles refer to the same thread. The posix thread handle is sometimes referred to as the `Thread ID'.
Pthread
Shorthand for Posix or Single Unix Specification Threads. As in `the interfaces described in this document are based on the Posix standard (ANSI/IEEE Standard 1003.1, 1996 Edition OR ISO/IEC 9945-1: 1996) and the Single UNIX Specification, Version 2, 1997'
Primary thread
See `Initial thread'

R

Recursive Mutex
A recursive mutex is a mutex that can be acquired again by the owning thread. A recursive mutex does not become unlocked until the number of unlock requests equals the number of successful lock requests. A non-recursive (i.e. normal) mutex will cause an EDEADLK error if an attempt is made by the owning thread to lock it a second time. See the functions pthread_mutexattr_setkind_np() or pthread_mutexattr_getkind_np().

S

Scheduling Parameters
Information describing the scheduling characteristics of a thread. The sched_param structure contains scheduling parameters. On the AS/400, the scheduling parameters only allow you to specify the priority of the thread. Scheduling Policy is restricted to the proprietary AS/400 scheduling policy. Use the pthread_attr_setschedparam(), pthread_attr_getschedparam(), pthread_setschedparam(), or pthread_getschedparam() functions to manipulate scheduling parameters.
Scheduling Policy
Information describing what algorithm will be used to schedule threads within the process or system. Some scheduling policies would be Round Robin, FIFO. The AS/400 uses the SCHED_OTHER constant to indicate the delay cost scheduling that the system uses. The scheduling parameter functions only support the SCHED_OTHER policy, and the pthread_attr_getschedpolicy() and pthread_attr_setschedpolicy() functions are not supported.
Scope
Information describing whether the scheduling policy indicates that threads compete directly with other threads within the process or the system. The AS/400 schedules threads within the system, and the pthread_attr_setscope() and pthread_attr_getscope() functions are not supported.
Secondary thread
Any thread started by or on behalf of the application that is not the `Initial thread'. Secondary threads are started by invoking pthread_create(), or another library service that creates threads. Secondary threads have no parent/child relationship.
Signal
An asynchronous mechanism for interrupting the processing of a thread. They system delivers a signal to a thread when the application programmer takes explicit or implicit action to cause the signal to be delivered. The signal can be sent to a thread or process, but is always delivered to a specific thread.
Signal Handler
A function registered by the application programmer that the system executes when a signal is delivered to a thread. The function runs immediately in the thread, interrupting any application processing that is in progress.
Signal Safe
A function, macro or operating system service that can be called safely from a signal handler. The function will always act in a well defined manner, and does not rely on any external state or locks that might be in an inconsistent state at the time the signal handler function is invoked by the system.
Signal Unsafe
A function, macro or operating system service that cannot be called safely from within a signal handler. A signal unsafe function may acquire locks or otherwise change the state of some resource. When the signal is delivered to the thread, the signal handler runs. The state of the resource or the lock managed by the signal unsafe function is unknown because it was interrupted by the signal before it completed. If the signal unsafe function is called again, the results will be non-deterministic.

T

Thread
An independent sequence of execution of program code and processing context inside a process.
A unique unit of work or flow of control within a process.
A thread runs a procedure asynchronously to other threads running the same or different procedures within the process. All threads within a process share activation group and process resources (Heap storage, static storage, open files, socket descriptors, other communications ports, environment variables, etc.) equally.
A thread has very few resources that are not shared (mutexes, locks, automatic storage, thread specific storage).
On a multi-processor system, multiple threads in a process can make progress concurrently.
Thread Capable
This term is AS/400 specific. On the AS/400, only those jobs that are `Thread Capable' are allowed to create threads. Certain system behavior and the architecture of the process changes slightly to support AS/400 threads. If a job is not Thread Capable, attempts to create a thread will result in the EBUSY error. You can create a thread capable process by using the spawn() interface, or by using other AS/400 job creation commands that allow you to specify that the new job should be thread capable.
Thread ID
The unique integral number associated with a thread that can be used to identify the thread. This integral number is available for retrieval via the pthread_getunique_np() interface. Although no Pthread interfaces use the integral thread ID to identify a thread for manipulation, `Thread ID' is sometimes used to describe the pthread_t data type that represents the abstraction to a thread. See `Posix thread handle'.
Thread Local Storage (TLS)
See `Thread Specific Storage'
ThreadSafe
A function, macro or operating system service that can be called from multiple threads in a process at the same time. The function will always act in a well defined manner. The end results will be as if the function was called by each thread in turn, even though all of the threads were running the function at the same time. Some APIs have restrictions about how they can be called in order for them to be thread safe. See the API documentation for all APIs or system services that you use in a multi-threaded job.
Thread Specific Storage
Storage that is not shared between threads, i.e. is `specific' to a thread, but can be accessed by all functions within that thread. Usually Thread Specific Storage is indexed by a key. The key is a global value visible to all threads, and it is used to retrieve the thread specific value of the storage associated with that key. Also called `Thread Private Storage', `Thread Local Storage' or `TLS'. See the pthread_getspecific(), pthread_setspecific(), pthread_key_create(), and pthread_key_delete() functions.
Thread Unsafe
A function, macro or operating system service that cannot be called from multiple threads. If this function is used in multiple threads or in a process that has multiple threads active, the results are undefined. Its possible for a thread unsafe function to corrupt or negatively interact with data in another function (thread safe or otherwise), that appears to be unrelated to the first function. Do NOT use thread unsafe functions in your multi-threaded application. Do NOT call programs or service programs that use thread unsafe functions. See the API documentation for all APIs or system services that you use in a multi-threaded job.


[Prev] [Contents] [Next]
Copyright © 1998, IBM Corporation. All rights reserved.
Comments? Contact
rchthrds@us.ibm.com