Information Technology Reference
In-Depth Information
Assume that a client c performs the call
fix-and-read-latch
.p/ (Algorithm
14.1
)
for a page p that currently is not cached at c.Thenc sends to the server the request
get-page
.p; m/,wherep is the page-id of the requested page and m
D
“read” is
the requested caching privilege. The request is processed at the server by the call
service-get-page
.p;m;c/ (Algorithm
14.5
). The server fixes and write-latches the
server version of page p and examines the cached-page table to see if the page is
cached for writing at some other client c
0
. If so, the server calls the page back from
c
0
. Then the server ships a copy of the now current server version of p to client c,
records p as cached at c for reading, and unlatches and unfixes p. Client c installs
the page in its cache and continues with the
fix-and-read-latch
.p/ call.
Algorithm 14.5
Procedure
service-get-page
.p;m;c/
fix-and-write-latch
.p/
if
page p is cached for writing at a client c
0
6D c
then
callback-page
.p;m;c
0
/
else
{page p is not cached for writing}
if
m D “write”
then
for
all clients c
0
6D c that cache p
do
callback-page
.p;m;c
0
/
end for
end if
end if
if
page p is cached at c and m D “write”
then
send write privilege on p to client c
else
send a copy of p with m privilege to client c
end if
record p as cached with m privilege at client c
unlatch-and-unfix
.p/
Algorithm 14.6
Procedure
service-get-write-privilege
.p; c/
fix-and-write-latch
.p/
for
all clients c
0
6D c that cache p
do
callback-page
.p;m;c
0
/
end for
send write privilege on p to client c
record p as cached for writing at client c
unlatch-and-unfix
.p/
Assume then that a client c performs the call
fix-and-write-latch
.p/ (Algo-
rithm
14.2
)forapagep that currently is not cached at c.Thenc sends to the server
the request
get-page
.p; m/,wherem
D
“write.” When processing the request at the
server by the call
service-get-page
.p;m;c/ (Algorithm
14.5
), if page p is cached
for updating at some other client c
0
, the page is called back, and its current version