Java Reference
In-Depth Information
Secondary Storage
Main Memory
(in RAM)
(on disk)
0
1
1
7
2
3
4
5
6
7
8
9
5
3
8
Figure8.5 An illustration of virtual memory. The complete collection of infor-
mation resides in the slower, secondary storage (on disk). Those sectors recently
accessed are held in the fast main memory (in RAM). In this example, copies of
Sectors 1, 7, 5, 3, and 8 from secondary storage are currently stored in the main
memory. If a memory access to Sector 9 is received, one of the sectors currently
in main memory must be replaced.
/ ** ADTforbufferpoolsusingthemessage-passingstyle * /
publicinterfaceBufferPoolADT{
/ ** Copy"sz"bytesfrom"space"toposition"pos"inthe
bufferedstorage * /
publicvoidinsert(byte[]space,intsz,intpos);
/ ** Copy"sz"bytesfromposition"pos"ofthebuffered
storageto"space". * /
publicvoidgetbytes(byte[]space,intsz,intpos);
}
This simple class provides an interface with two member functions, insert
and getbytes . The information is passed between the buffer pool user and the
buffer pool through the space parameter. This is storage space, provided by the
bufferpool client and at least sz bytes long, which the buffer pool can take in-
formation from (the insert function) or put information into (the getbytes
function). Parameter pos indicates where the information will be placed in the
buffer pool's logical storage space. Physically, it will actually be copied to the ap-
propriate byte position in some buffer in the buffer pool. This ADT is similar to
the read and write methods of the RandomAccessFile class discussed in
Section 8.4.
Search WWH ::




Custom Search