Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A file has r=20,000 STUDENT records of fixed-length. Each record has the followi

ID: 3773340 • Letter: A

Question

A file has r=20,000 STUDENT records of fixed-length. Each record has the following fields:

NAME (30 bytes),

SSN (9 bytes),

ADDRESS (40 bytes),

PHONE (9 bytes),

BIRTHDATE (8 bytes),

SEX (1 byte),

MAJORDEPTCODE (4 bytes),

MINORDEPTCODE (4 bytes),

CLASSCODE (4 bytes, integer),

and DEGREEPROGRAM (3 bytes).

An additional byte is used as a deletion marker. The file is stored on the diskwhose parameters are given as follows:block size B= 512 byte; average seek time s= 30 msec; average rotational delay rd=12.5msec; block transfer rate btt= 1 msec; interblock gap size G=128 byte.

(a) Calculate the record size R in bytes (including the deletion marker).

(b) Calculate the blocking factor bfrand the number of disk blocks b,assuming anunspannedorganization.

(c) Calculate the average time it takes to find a record by doing a linear searchonthe file if the file blocks are stored contiguously and double buffering is used.

(d) Calculate the average time it takes to find a record by doing a linear searchonthe file if the file blocks are not stored contiguously.

(e) Assume the file is ordered by SSN; calculate the time it takes to search for arecord given its SSN value by doing a binary search.

Explanation / Answer

a)

Record size R in bytes will be

R =  (30 + 9 + 40 + 9 + 8 + 1 + 4 + 4 + 4 + 3) + 1 = 113 bytes

b)

bfr = floor(B / R) = floor(512 / 113) = 4 records per block

b = ceil(r / bfr) = ceil(20000 / 4) = 5000 blocks (r=20,000 given)

c)
the time to
read 2500 consecutive blocks when double buffering is allowed will be= s+rd+(2500*(B/btr))
= 30+12.5+(2500*(512/409.6))
= 3167.5 msec
= 3.1675 sec

d)

if blocks are scattered that means that we need to buffer it first so it time will be
2500 * (s + rd + btt) = 2500 * (30 + 12.5 + 1)
= 108750 msec
= 108.75 second

e)

the time to search for a record = ceil(log2 b) * (s +rd + btt) = ceil(log2 5000) * (30 + 12.5 + 1) = 13 * 43.5 = 565.5 msec = 0.5655 second

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote