5-24 IBM Informix OnLine Database Server Administrator’s Guide

Psort and Shared Memory

Psort and Shared Memory

Each parallel sort uses one UNIX shared-memory segment.
A front-end process is able to open an unlimited number ofSELECT cursors
that contain anORDER BY clause. However, the number of sorts that can be
executed in parallel is limited by the number of shared-memory segments
that each OnLine database server process can attach to. (For more details
about the UNIX parameter that specifies the maximum number of attached
shared-memorysegments per process, refer to page 2-18.) All cursors beyond
theUNIX limit are executed using nonparallel sorts.
SPINCNT Configuration Parameter
Familiarize yourself with the function of a shared-memory latch before you
begin this section. Refer to page 2-41 for background information.
When an OnLine user process attempts to acquire a latch, it tests for avail-
ability.Ifthe latch is not available, the user process can either wait or not wait.
Athird option is available on some multiprocessor UNIX operating systems:
spin and test again.
Ina multiprocessor environment, it is possible for two OnLine user processes
tobe resident in a CPU and for both user processes to need access to the same
resource. Normally, one user process acquires the resource while the other
process waits. The waiting user process “sleeps,” meaning that the user
process is switched out of theCPU.
Ifa machine supports spin and test, the waiting user process does not sleep.
Instead, it “spins.” The “spinning” that the user process performs while it
waitsis an assembly-level activity that varies among machines. The activity
itself does nothing.
The advantage of spinning and testing is that the waiting user process
remains in theCPU. This eliminates the overhead of context switching; that
is,the overhead that is incurred when the user process is switched in and out
of the CPU. The spin-and-test approach is more efficient than sleeping.