Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How does spin count really works
ctcgag_at_hotmail.com wrote in message news:<20041109125111.221$g2_at_newsreader.com>...
> bchorng_at_yahoo.com (Bass Chorng) wrote:
> > I have a question on how spin counting really works.
> >
> > Lets assume the default of 2000 on _spin_count. So a latch
> > miss session starts kernel code loop for 2000 times and try
> > it again.
>
> No, I think it just tries again, upto 2000 times.
This is incorrect. Spin count is just a bogus code loop for _spin_count times so that the process does not get a voluntary context switch. It will go to sleep for a random time frame, within a range, then wakes up to try again. Everytime it goes to sleep, it sleeps longer. The point of using ranged random sleep time is to avoid multiple processes waking up at the same time. I think after 10 sleeps, it starts all over again for another spin count. So spin count definitely is the number of code loops so the process can bind to a CPU without being swapped out.
But this is deviating from my original question. Someone already answered my question offline. So the answer is during spin counting, if the latch becomes available, spin count will interrupt and latch will be obtained.
Latch availability is tested in between each loop. Received on Fri Nov 12 2004 - 11:53:32 CST