
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 of SELECT cursors
that contain an ORDER 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-memorysegmentsperprocess,refertopage 2-18.)Allcursorsbeyond
the UNIX 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.Ifthelatchisnotavailable,theuserprocesscaneitherwaitornotwait.
A third option is available on some multiprocessor UNIX operating systems:
spin and test again.
Inamultiprocessorenvironment,itispossiblefortwoOnLineuserprocesses
tobe residentin a CPU and for both userprocessesto need accesstothesame
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 the CPU.
If a machine supports spin and test, the waiting user process does not sleep.
Instead, it “spins.” The “spinning” that the user process performs while it
waits is 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 the CPU. This eliminates the overhead of context switching; that
is,theoverheadthatis incurredwhenthe user processis switched in andout
of the CPU. The spin-and-test approach is more efficient than sleeping.
Commenti su questo manuale