Latch wait posting

refer:http://www.ixora.com.au/q+a/0009/23120936.htm

 

 

From:Steve Adams
Date:23-Sep-2000 12:09
Subject:  Latch wait posting


The _latch_wait_posting parameter has three possible values. The default value is 1, which means that latch wait posting is used for the "long" latches only. The alternative values are 0 (to disable latch wait posting entirely) and 2 (to enable latch wait posting for all latches).

The note that you have quoted is incorrect at 2 points: It implies that processes do not bother to spin for long latches. In fact they do. A cursory glance at some latching statistics should be enough to convince you of that fact. The note also states that all waiters are posted when a long latch is freed. Again, the statistics demonstrate that this is not the case, although you would need heavy contention to see it. If it were so, the waiters woken statistics would rise exponentially with sleeps during episodes of latch contention, whereas in fact it just rises linearly.

 

I'm reading your excellent "Oracle8i Internal Services" book. I've some questions about "latch wait posting" on page 27:
How does the Oracle process (releasing a latch) decide which process will be woken-up in latch free list?
How is that list managed? If it is FIFO, what is the diffrence from basic enqueue?
Is there still spinning for that mode, or is there just waiting for being posted by another process?

Note 104426.1 says:

Short Wait Latches
------------------

Short wait latches are characterised by the expectation that waiters will
not have to wait for any excessive duration prior to getting the latch.
Because of this, waiters spin on the cpu until the latch is freed.

Once the latch is freed the process grabs the latch and performs whatever
operation it was waiting to perform. When a short wait latch is freed by a
process no other processes are notified; the latch is simply freed.


Long Wait Latches
-----------------

Long wait latches are expected to be held for longer periods of time, so when
an attempt to get the latch is unsuccessful, the process goes to sleep for a
period of time, wakes up, and retries the latch get operation, repeating this
cycle until the latch get is successfully grabbed.

This procedure prevents excessive cpu being used as would be the case if the
procedure was to spin on a latch that is being held for a long time.

When the latch is freed, all waiters are posted to tell them that the latch
is free. Among other things this:

o prevents waiters from sleeping unnecessarily if the latch is free
o give waiters an equal chance of grabbing the latch

An example of a long wait latch is the library cache latch since
finding matching SQL in a hash chain has the potential to be a long running
activity.

The parameter _latch_wait_posting changes behavior of short
wait and long wait latches.

I'm confused. If "Long Wait Latches" use the "latch wait posting" mecahnism, how does '_latch_wait_posting' change the behavior of long wait latches?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值