RE: Spinning on CPU waiting for latch

  • From: Jonathan Lewis <jonathan@xxxxxxxxxxxxxxxxxx>
  • To: "Hemant-K.Chitale@xxxxxx" <Hemant-K.Chitale@xxxxxx>, ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 22 May 2014 07:28:44 +0000

If it's actually in its "spincount" for the latch it's on the CPU (or waiting 
in the runqueue) and ASH will record "ON CPU".
It's hard to prove this point because a spin takes a very short time and it's 
hard to rig a test where you KNOW that a process is spinning just as ASH takes 
a sample.

Perhaps if you set up a test system with an extremely high spin_count, got one 
process to acquire all the redo copy latches (using oradebug to call the latch 
get subroutine), then got another process to do an update you'd be able to see 
the second process go into a spin cycle trying to get a redo copy latch.  
(Haven't tried this, might be fun, do not attempt on anything but a private 
system - probably needs multiple CPUs, though).


Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
@jloracle
________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [oracle-l-bounce@xxxxxxxxxxxxx] on behalf 
of Chitale, Hemant K [Hemant-K.Chitale@xxxxxx]
Sent: 22 May 2014 03:39
To: ORACLE-L
Subject: Spinning on CPU waiting for latch


If a database server process is in a “spin loop” on CPU waiting for a latch, 
does ASH show status=’ON CPU’ or status=’WAITING’ with the event being the 
latch wait.

Just wondering.....

I can’t create a test case.

It doesn’t matter for a single process but when you have dozens and hundreds of 
processes going through this during the day, there should be a noticeable 
difference between the OS’s cpu %usr and Oracle ASH’s ‘ON CPU’  --- as it is 
there is always a difference because ASH samples in V$ are every second while 
in DBA_HIST are 1 in 10 samples only.

Hemant K Chitale

This email and any attachments are confidential and may also be privileged. If 
you are not the intended recipient, please delete all copies and notify the 
sender immediately. You may wish to refer to the incorporation details of 
Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at 
https://www.sc.com/en/incorporation-details.html.

Other related posts: