HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)
p
pthread(3T) pthread(3T)
(Pthread Library)
end result is that a low-priority thread blocks a high-priority thread.
Process
A process can be thought of as a container for one or more threads of execution, an address space, and
shared process resources. All processes have at least one thread. Each thread in the process executes
within the process’ address space. Examples of process-shared resources are open file descriptors, mes-
sage queue descriptors, mutexes, and semaphores.
Process Control Block (PCB)
This structure holds the register context of a process.
Process Structure
The operating system maintains a process structure for each process in the system. This structure
represents the actual process internally in the system. A sample of process structure information
includes the process ID, the process’ set of open files, and the signal vector. The process structure and the
values contained within it are part of the context of a process.
Program Counter (PC)
The program counter is part of the register context of a process. It holds the address of the current
instruction to be executed.
Race Condition
When the result of two or more threads performing an operation depends on unpredictable timing factors,
this is a race condition.
Read-Write Lock
A read-write lock is a synchronization primitive. Read-write locks provide threads with the ability to
regulate or serialize access to process-shared data and resources. Read-write locks allow multiple
readers to concurrently acquire the read lock whereas only one writer at a time may acquire the write
lock. These locks are useful for shared data that is mostly read and only rarely written.
Reentrant Function
A reentrant function is one that when called by multiple threads, behaves as if the function was called
serially, one after another, by the different threads. These functions may execute in parallel.
Scheduling Allocation Domain
The set of processors on which a thread is scheduled. The size of this domain may dynamically change
over time. Threads may also be moved from one domain to another.
Scheduling Contention Scope
The scheduling contention scope defines the group of threads that a thread competes with for access to
resources. The contention scope is most often associated with access to a processor. However, this scope
may also be used when threads compete for other resources. Threads with the system scope compete for
access to resources with all other threads in the system. Threads with the process scope compete for
access to resources with other process scope threads in the process.
Scheduling Policy
A scheduling policy is a set of rules used to determine how and when multiple threads are scheduled to
execute. The scheduling policy also determines how long a thread is allowed to execute.
Scheduling Priority
A scheduling priority is a numeric priority value assigned to threads in certain scheduling policies.
Threads with higher priorities are given preference when scheduling decisions are made.
Semaphore
A semaphore is similar to a mutex. A semaphore regulates access to one or more shared objects. A sema-
phore has a value associated with it. The value is generally set to the number of shared resources regu-
lated by the semaphore. When a semaphore has a value of one, it is a binary semaphore. A mutex is
essentially a binary semaphore. When a semaphore has a value greater than one, it is known as a
countingsemaphore. A counting semaphore can be locked by multiple threads simultaneously. Each time
the semaphore is locked, the value is decremented by one. After the value reaches zero, new attempts to
lock the semaphore cause the locking thread to block until the semaphore is unlocked by another thread.
Section 3−−750 Hewlett-Packard Company − 10 − HP-UX 11i Version 2: September 2004