IBM 000-8697 Bedienungsanleitung Seite 136

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 702
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 135
2-42 IBM Informix OnLine Database Server Administrator’s Guide
Managing Shared-Memory Resources
If an OnLine user process requires a specific latch, how does it determine if
the latch is available? The user process has two options:
Test for the latch; if unavailable, do not wait (that is, do not block).
Test for the latch; if unavailable, wait (that is, block).
Test-and-Set Institutions
Mostmachinesuseasingletest-and-setinstructionaspartofthetestthateach
user process performs in its attempt to acquire a shared-memory latch. Test-
and-set, or TAS, prevents confusion between two user processes in a
multiuser environment. Without TAS, a user process could be interrupted
betweenthetestofthelatch(toseeifitisavailable)andthesettingofthelatch
(to make it unavailable to other user processes). The interrupt could create a
situation in whichmorethan oneuser process received “exclusive” access to
a resource.
To see how this confusion could occur, consider the following scenario.
Server Process A needsto acquire latch 201.ProcessA performs atest for the
latch and receives a positive response; the latch is available. Then the
processing time period for Process A ends. Process B begins executing.
Process B also needs latch 201. Process B performs a test for the latch and
receivesapositiveresponsesincethelatchis still available. ProcessBsets the
latch and continues processing. Process B is interrupted (that is, its timeslice
expired) before it is ready to release the latch. When Process A continues
executing, it incorrectly assumes that it can claim latch 201. The test-and-set
instruction performs the latch test and sets the latch as a single, uninter-
ruptable event, eliminating confusion among processes.
Spin and Test Again
WhenanOnLine user processattempts to acquirea latch, it teststhelatchfor
availability. If the latch is not available, the user process can either block or
notblock.AthirdoptionisavailableonsomemultiprocessorUNIXoperating
systems: spin and test again. The benefit of spinning instead of blocking is
that a user process can test for latch availability multiple times without the
overhead cost of putting the user process to sleep and later waking it. The
configuration parameter SPINCNT specifies the number of times that a user
processcan spinand testwithout actuallygoing tosleep. (Referto page 5-24
for information about tuning this parameter to improve performance.)
Seitenansicht 135
1 2 ... 131 132 133 134 135 136 137 138 139 140 141 ... 701 702

Kommentare zu diesen Handbüchern

Keine Kommentare