Suppose that a disk unit has the following parameters: seek time s=20 msec; rotational delay rd=10 msec; block transfer time btt=1 msec; block size B=2400 bytes; interblock gap size G=600 bytes. An EMPLOYEE file has the following fields: SSN, 9 bytes; LASTNAME, 20 bytes; FIRSTNAME, 20 bytes; MIDDLE INIT, 1 byte; BIRTHDATE, 10 bytes; ADDRESS, 35 bytes); PHONE, 12 bytes); SUPERVISORSSN, 9 bytes; DEPARTMENT, 4 bytes; JOBCODE, 4 bytes; deletion marker, 1 byte. The EMPLOYEE file has r=30000 STUDENT records, fixed-length format, and unspanned blocking. Write down appropriate formulas and calculate the following values for the above EMPLOYEE file:
(a) The record size R (including the deletion marker), the blocking factor bfr, and the number of disk blocks b.
(b) Calculate the wasted space in each disk block because of the unspanned organization.
(c) Calculate the transfer rate tr and the bulk transfer rate btr for this disk (see
Appendix B for definitions of tr and btr).
(d) Calculate the average number of block accesses needed to search for an arbitrary record in the file, using linear search.
(e) Calculate the average time needed in msec to search for an arbitrary record in the file, using linear search, if the file blocks are stored on consecutive disk blocks and double buffering is used.
(f) Calculate the average time needed in msec to search for an arbitrary record in
the file, using linear search, if the file blocks are not stored on consecutive disk
blocks.
(g) Assume that the records are ordered via some key field. Calculate the average
number of block accesses and the average time needed to search for an arbitrary
record in the file, using binary search.
(a) R = (9 + 20 + 20 + 1 + 10 + 35 + 12 + 9 + 4 + 4) + 1 = 125 bytes
bfr = floor(B / R) = floor(2400 / 125) = 19 records per block
b = ceiling(r / bfr) = ceiling(30000 / 19) = 1579 blocks
(b) Wasted space per block = B - (R * Bfr) = 2400 - (125 * 19) = 25 bytes
(c) Transfer rate tr= B/btt = 2400 / 1 = 2400 bytes/msec
bulk transfer rate btr= tr * ( B/(B+G) )
= 2400*(2400/(2400+600)) = 1920 bytes/msec
(d) For linear search we have the following cases:
i. search on key field:
if record is found, half the file blocks are searched on average: b/2= 1579/2 blocks
if record is not found, all file blocks are searched: b = 1579 blocks
ii. search on non-key field:
all file blocks must be searched: b = 1579 blocks
(e) If the blocks are stored consecutively, and double buffering is used, the time to read
n consecutive blocks= s+rd+(n*(B/btr))
i. if n=b/2: time = 20+10+((1579/2)*(2400/1920))= 1016.9 msec = 1.017 sec
(a less accurate estimate is = s+rd+(n*btt)= 20+10+(1579/2)*1= 819.5 msec)
ii. if n=b: time = 20+10+(1579*(2400/1920))= 2003.75 msec = 2.004 sec
(a less accurate estimate is = s+rd+(n*btt)= 20+10+1579*1= 1609 msec)
(f) If the blocks are scattered over the disk, a seek is needed for each block, so the time
to search n blocks is: n * (s + rd + btt)
i. if n=b/2: time = (1579/2)*(20+10+1)= 24474.5 msec = 24.475 sec
ii. if n=b: time = 1579*(20+10+1)= 48949 msec = 48.949 sec
(g) For binary search, the time to search for a record is estimated as:
ceiling(log 2 b) * (s +rd + btt)
= ceiling(log 2 1579) * (20+10+1) = 11 * 31 = 341 msec = 0.341 sec
You might also like to view...
Locate and launch the web browser application. Can you navigate to your favorite search engine?
Familiarize yourself with the virtual machine. The virtual machine you just installed can be used to complete many of the labs in this course. Familiarize yourself with the icons in the list below: The launcher bar icons are (from left to right): ? Show the desktop ? Terminal application ? File manager application ? Web browser application (Firefox) ? File search tool ? Current user’s home directory All course related applications are located under Applications Menu > CyberOPs.
Logical operators, sometimes referred to as ____ operators, allow you to combine two or more conditions into one compound condition.
A. truth B. compound C. Boolean D. syntactic
________ controls are not connected to fields in a table or query
Fill in the blank(s) with correct word
One of the items to be defined in the program specification is the program's objectives.
Answer the following statement true (T) or false (F)