Which of the following is the correct bfr and number of blocks to store a table in a disk?
Question:
3) Consider a disk with following
characteristics; Block size 512 bytes, number of blocks per track 25 and number
of tracks per surface 500. Also assume that there is a table EMPLOYEE with
10000 fixed length records and each record is of size 101 bytes. Which of the
following is the correct bfr (blocking factor) and number of blocks combination
if we assume an unspanned organization?
a) 5 and 2000
b) 5 and 1000
c) 6 and 2000
d) 6 and 1000
Answer:
a) 5 and 2000
Discussion:
Given,
Block
size -
512 bytes (required)
Number
of blocks per track –
25 (Not required)
Number
of tracks per surface –
500 (Not required)
Number
of records in EMPLOYEE – 10000 (required)
Record
size -
101 bytes (required)
Find bfr and number of blocks required
to store entire EMPLOYEE records.
- Spanned/Unspanned records – For example, if one block is of size 10 bytes and we have records of size 3 bytes each. Then each block can contain only 3 records. 3 * 3 = 9 bytes. We cannot store fourth record first byte in one block and the rest in the next block. This kind of records organization is unspanned. If we span the record in two blocks, then the organization or records is spanned records.
- Blocking factor (bfr) – Number of records fit per block.
- For spanned records, bfr = ceiling(B/R) where B is the block size and R is the record size.
- For unspanned records, bfr = floor(B/R).
Answer:
Bfr for unspanned records = floor(B/R)
= floor(512/101) = floor(5.07)
=
5
Number of blocks required =
ceiling(r/bfr) where r is the number of records in the table.
=
ceiling (10000/5) = 2000
Hence, bfr is 5 and the number of
blocks is 2000.
No comments:
Post a Comment