C H A P T E R  4

Locks and Latches

I would have included pins and mutexes in the title, but that would have made it too long and lose the alliteration. Oracle uses all four mechanisms to ensure that resources don’t get damaged by conflicting requirements for access and modification. The mechanisms may slow down the rate at which you are allowed to work, to ensure that you can work safely, although, as we shall see in Chapter 7, some of the mechanisms can save you time when you keep repeating the same piece of work.

There are two significant differences between locks and latches. Locks and pins adopt a polite, queue-like strategy with a first-come, first-served approach, while latches and mutexes adopt a pushy strategy where everyone tries to grab the latch simultaneously. Secondly, locks, pins, and some mutexes tend to be held for a significant amount of time, while latches should be held only very briefly. The differences are, in many ways, a side effect of the difference in usage—locks tend to be used to protect objects, while latches tend to be used to protect shared memory, so the latch activity tends to be highly concurrent and very quick.

As you can see from these comments, mutexes (which started to appear in Oracle Database 10g most significantly as a replacement for pins in the library cache) fall somewhere between locks and latches: sessions fight over mutexes the way they fight over latches, but sessions can hold mutexes for long periods just as they can hold locks (and pins) for a long time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.39.252