You were brought to this page based on an internet search
and as a free service to Oracle DBAs.
The text below is an except from the book,
Oracle Performance Firefighting, written by
Craig Shallahamer of
OraPub, Inc.
Figures and tables are not included on this page, only their reference.
To order the book in either print or PDF form, click
here.
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
-------------------------------
The developer also needs to know if the latch request type is immediate or willing to wait. An immediate latch request, sometimes called a nowait request, is a single "give me the latch this instant" request. This is commonly called a fast get, and this Fast_Get function is shown in Figure 3-7.
Essentially, the Oracle process checks the latch's memory address to see if another process is already associated with the latch. A more colorful illustration is thinking of this as if a person is trying to acquire a latch. Picture a man running into a room where that specific latch (or child latch) is being requested and then making a single grab for the latch (think token or baton). The man then looks in his hand and either sees the latch or does not see the latch. If the latch has been successfully acquired the man yells, "I've got it!" Otherwise, he says, "Dang! I didn't get the latch!" What happens next is when it really gets interesting.
A willing-to-wait latch request consists of repeated fast gets. But I'm getting ahead of myself. Figure 3-6 shows the pseudocode for the main Get_Latch request. If the request type is willing to wait, flow jumps down to that portion of the pseudocode. Interestingly, Oracle immediately performs a fast get-a single latch request. If that request fails, which is highly likely in an active production system, control continues down to the spin-sleep loop. Notice the While loop with the TRUE condition set. Unless the process is interrupted, the Oracle process will continue spinning and sleeping until the latch has been acquired. Truly, the process is willing to wait!
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
|