ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Latch Levels

Latch Levels

原创 Linux操作系统 作者:yyp2009 时间:2012-05-30 00:58:57 0 删除 编辑
http://www.itpub.net/thread-739487-1-1.html
 
 
Steve Adams的书中的latch levels提到:
It is very common for an Oracle process to need to hold a number of latches
concurrently. Therefore, there might be a possibility of latching deadlocks
occurring—namely, one process holding latch A and another process holding
latch B, and both processes spinning and waiting for the alternate latch. Oracle
ensures that this cannot happen by ensuring that latches are always taken in a
defined order, when more than one latch is required. To support this, every latch
in Oracle has a level between and 15, and a 2-byte bitmap is maintained for every
process representing the levels of the latches that the process is currently holding.
When a process attempts to get a latch in willing-to-wait mode, a check is made
to ensure that it is not already holding a latch at the same level or at a higher
level. In general, if this rule is broken, an ORA-600 [504] internal error is
raised.

Contention for a high-level latch such as the redo allocation latch (level 6) can
easily exacerbate contention for lower-level latches such as the cache buffers
chains latches (level 1 in Oracle 8.1).
 
 
level的规定,实际上是对进程获得latch进行了序列化、串行化控制。

简单地使用level 来控制(争用相对少,这样实现简单、成本低,如果采用 lock 机制那成本太高了),避免 dead lock。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13750068/viewspace-731425/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-10-17

  • 博文量
    330
  • 访问量
    1027076