Thursday, August 1, 2013

What is a Latch


Latch

Oracle SGA consists of numerous data structures such as Buffer Cache, Shared pool, Library cache, Dictionary cache, redo log buffer etc. Many oracle processes need to access these SGA data structures concurrently. Though these SGA components are shared, only one process must be able to modify it at any particular point in time. Oracle achieves this by protecting the SGA data structures with latches.

Latches do not allow multiple processes to inspect the protected data structures simultaneously. They provide only exclusive access. A latch is a kind of lock that can be very quickly acquired and freed.

When do Oracle Process obtain a latch?

Oracle sessions need to update or read from the SGA for almost all operations. For instance,

  • When a session performs a physical read, it must modify a free block in the buffer cache and adjust the Buffer Cache LRU Chain.
  • When a session reads a block from the SGA, it will modify the LRU chain.
  • When a new SQL statement is parsed, it will be added to the library cache.
  • As changes are made to blocks, entries are placed in the redo buffer.
  • The DBWr and redo log writer writes buffers from buffer to disks.

Latches prevent any of these operations from colliding and possible corrupting the same area of SGA.

A process acquires a latch when working with a structure in the SGA. It continues to hold the latch for the period of time it works with the structure. The latch is dropped when the process is finished with the structure. Each latch protects a different set of data, identified by the name of the latch.

Latches are held for short periods of time and provide a mechanism for cleanup in case a holder dies abnormally while holding it. This cleaning is done using the services of PMON.

Latches Vs Locks

Request Queuing: Request for locks are queued and serviced in order, whereas there is no request queuing in latches the process requests for latch until it succeeds. Latches are serviced in random.

Management: Locks management is complex because of their support for queuing and concurrency. Latch management is simple, essentially just a single location in memory representing the state of a latch.

Because latches are very efficient Oracle uses latch to protect the data structures  that are expected to be accessed briefly and intermittently.

Thanks

8 comments:

Path Infotech said...

Path Infotech is in the field of oracle training program from past several years.

For more info : Oracle Certification Program

Unknown said...

Nice Blog: Author Ajay Rathod

Unknown said...

Hi..
I read your post. it is a fantastic post..

Thanks for sharing this useful post with us.

Set Your Own Business With Small Budget Via Receiving Mobile Recharge API.

Unknown said...

Hi..
I read your post. it is a fantastic post..

Thanks for sharing this useful post with us
https://goo.gl/emE4PB

Anonymous said...

Very intersting post.It is very useful blog. I share the post many social sites. Its best service provide 24 hour Des Moines Towing.Thanks for sharing this healthy dish.

Unknown said...

Oracle is big company for software development. I work in Software development company. In this time i doing work in father jewelry site. In my college time i gave interview in Oracle company but my interview not clear.

Gavin said...

Oracle company is work on Data structure. Oracle SGA consists of numerous data structures such as Buffer Cache, Shared pool, Library cache, Dictionary cache, redo log buffer etc. property management pierce county wa is best site for property.

Techystick said...

world777 betting
flats under 15 lakh
best coaching classes for class 12 in gurgaon
kurti pant set
kurti pant set with duppatta
azure firewall
azure blueprints
azure resource group
azure application gateway
azure express route

Followers

Powered By Blogger
 

Oracle Database Administration. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com