Tutorial for Using VDB library
CSY@cs.nthu.edu.tw
June 21, 2009
1 What do VDB do
VDB(Virtual Disk Block) is a tool for calculating disk access when the program is actually
implemented in internal memory. It provides simple and clear APIs ,as well as straightfoward
view of simulation.
2 How to install
To create a .a library archive, just type make in your terminal. And a libvdb.a will be generated
it anything goes correctly. To link this library with your program, just
$cc yourprogram.c -lvdb -lm -Lpathtolib
For example,
$gcc test.c -lvdb -lm -L/usr/lib
3 Meaning of functions
3.1 VDB init(&profile,blockSize,cacheNum,hashBit,replacement)
This function initiates the profile of current session. Informations are:
1. blockSize ,the size of each virtual block
2. cacheNum ,the number of available blocks in internal memory
3. hashBit ,the number of bits to be hashed, begin from least-significant one.
4. replacement ,page replacement algorithm, currently only ALGO LFU and ALGO 2ND
available
3.2 VDB push(&profile,&data,dsize)
This function pushes a data with virtual size of dsize into the whole block structure.
1