Suppose that a file initially contains \(r=120,000\) records of \(R=200\) bytes each in an unsorted (heap) file. The block size \(B=2400\) bytes, the average seek time \(s=\) \(16 \mathrm{ms}\), the average rotational latency \(r d=8.3 \mathrm{ms}\) and the block transfer time \(b t t=\) \(0.8 \mathrm{ms} .\) Assume that 1 record is deleted for every 2 records added until the total number of active records is 240,000 a. How many block transfers are needed to reorganize the file? b. How long does it take to find a record right before reorganization? c. How long does it take to find a record right after reorganization?

Short Answer

Expert verified
a. The number of block transfers needed to reorganize the file is 20,000. b. The time to find a record right before reorganization is 247 seconds. c. The time to find a record right after reorganization is 494 seconds.

Step by step solution

01

Calculate the total blocks

The total blocks can be calculated by dividing the total bytes by the block size. Given that each record is \(R=200\) bytes and initially we have \(r=120,000\) records, the total bytes will be \(r * R = 120,000 * 200 = 24,000,000\) bytes. And the block size \(B=2400\) bytes. Thus, the total blocks is \(24,000,000 / 2400 = 10,000\) blocks.
02

Find the total number of block transfers

Assuming that 1 record is deleted for every 2 records added until the total number of records is 240,000, that means there will be \(240,000 - 120,000 = 120,000\) records added. These additional records will require \(120,000 * R / B = 120,000 * 200 / 2400 = 10,000\) extra blocks. Hence, the total number of block transfers will be the sum of the initial blocks and the extra blocks needed for the added records, so, \(10,000 + 10,000 = 20,000\) block transfers.
03

Find the time to find a record before reorganization

Before reorganization, the time to find a record is the sum of the seek time \(s\), the rotational latency \(rd\), and the time to transfer a block. Assuming the file is unsorted and we need to read half the blocks on average, the total time will be \((s + rd + btt/2) * Total Blocks = (16 ms + 8.3 ms + 0.8 ms/2) * 10,000 = 247,000 ms or 247 seconds.
04

Find the time to find a record after reorganization

After reorganization, the time to find a record is the same as before but the total blocks are now \(20,000\). Therefore, the total time will be \((s + rd + btt/2) * Total Blocks = (16 ms + 8.3 ms + 0.8 ms/2) * 20,000 = 494,000 ms or 494 seconds.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free