Information Technology Reference
In-Depth Information
read the page, while a write privilege (or write token ) entitles the client both to read
and update the page.
The caching privilege is stored locally in the cache control block of the page in
the client cache. Cache control blocks are main-memory structures similar to the
buffer control blocks used to manage buffered pages in the server buffer. We say
that a page is cached for reading (resp. cached for writing ) at a client, if the page is
cached at the client and the client holds read privilege (resp. write privilege) on it.
Many clients can simultaneously hold a read privilege on a page p,sothatpage
p can be cached for reading at several clients at the same time. Only one client at a
time can hold a write privilege on p, so that, even if p is cached at several clients,
only one of the clients is allowed to update the page while the other clients can only
cache the page for reading. According to the caching protocol considered in this
chapter, a page cached for updating at some client is not allowed to be cached at any
other client even for reading: granting a write privilege on page p for some client c
is possible only if no other client currently caches p.
The fixing of a page p for a client-database-process thread at client c includes
shipping the page from the server if the page is not yet cached at c.Attheserver,
the server-process thread that services client c fixes and read-latches p, ships a copy
of p to c, and unlatches and unfixes p. Unfixing page p at client c does not cause
any communication between the server and the client: page p remains at the client
cache, and the cached-page table at the server retains the information about caching
p at c with the privilege last granted.
The client calls fix-and-read-latch .p/ and fix-and-write-latch .p/ are given as
Algorithms 14.1 and 14.2 . The call reserve-cache-frame .p/ reserves a free frame
in the client cache for page p. If there is currently no free frame, the least-recently-
used page p 0 is evicted from the cache. If p 0 is a modified page, a copy of it and
copies of all log records with LSN s up to and including P AGE -LSN .p 0 / written at the
client and not yet shipped to the server are now shipped to the server with a message
stating that the client gives up caching page p 0 .
Algorithm 14.1 Client procedure fix-and-read-latch .p/
if page p is cached at the client then
fix p and acquire a read latch on p
else
reserve-cache-frame .p/
fix and acquire a read latch on p
send the request get-page .p; “read”/ to the server
wait for a response (copy of p)
install page p into the cache frame
mark p as an unmodified page
record the read privilege on p in the cache control block
end if
return the address of the cache frame of p to the caller
 
Search WWH ::




Custom Search