Re: consistent read and LIO question
Date: Mon, 27 Apr 2009 22:03:17 +0000 (UTC)
Message-ID: <gt5a34$p9c$1_at_solani.org>
On Sun, 26 Apr 2009 08:22:05 -0700, lsllcm wrote:
> What is the difference "cache buffer chains latch" and "buffer handle"?
> Are they same?
No. Buffer handle is a pointer to the buffer, along with the status
information. Buffer handles form structures called "linked lists".
In order to manipulate a linked list, you have to acquire a lock of
a sort. The qualification "of a sort" is necessary because there are
no real locks and certainly no queues. There is a shared memory structure
that the proces which needs to manipulate a list of buffers needs to
"own". The underlying mechanism is called a spin lock and is based on
atomic instruction called "test and set lock" (TSL). In short, CPU tests a
memory location and checks if its value is zero. If it is, it sets it
to 1. If it isn't, the instruction returns status that it was
unsuccessful. The process then spins in an idle loop, spending certain
amount of iterations before it retries. I can only recommend Andrew
Tannenbaum's "Modern Operating Systems" and the chapter on synchronization
mechanisms and critical sections. The book is more then 20 years old, but
is still modern. Given the fact that Tannenbaum's book is very old, it's
probably hard to come by. Here is a decent explanation of a spin lock:
http://en.wikipedia.org/wiki/Spin_lock
http://www.if.uidaho.edu/~bgray/classes/cs341/doc/tsl.html
Cache chain latches are spin locks that protect linked lists of buffer
handles.
-- http://mgogala.freehostia.comReceived on Mon Apr 27 2009 - 17:03:17 CDT