RE: Spinning on CPU waiting for latch

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 22 May 2014 07:28:44 +0000
Message-ID: <CE70217733273F49A8A162EE074F64D901DF5751_at_exmbx05.thus.corp>


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
_at_jloracle



From: oracle-l-bounce_at_freelists.org [oracle-l-bounce_at_freelists.org] on behalf of Chitale, Hemant K [Hemant-K.Chitale_at_sc.com] 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.

--
http://www.freelists.org/webpage/oracle-l
Received on Thu May 22 2014 - 09:28:44 CEST

Original text of this message