Time when the disk reads data

Source: Internet
Author: User
The arrangement of data stored on the disk affects the total time of the I/O service.

Assume that each track is divided into 10 physical blocks, each of which stores one logical record. Logical record R! Logical records. The logical records R1, R2, Zookeeper, and R10 are stored on the same track. The order of the records is shown in the following table:

Physical Block 1 2 3 4 5 6 7 8 9 10

Logical record R1 R2 R3 R4 R5 R6 R7 R8 R9 R10

Assuming that the disk rotation speed is 20 ms, the head is currently at the beginning of R1. If the system processes these records sequentially and uses a single buffer, each record can be processed for 4 ms, the maximum processing time for these 10 records is ___. If the distribution of information storage is optimized, the minimum time for processing 10 records is _______

 

First, from the disk speed: 20 ms/circle, we can know that it takes 2 ms to read a record. It is worth noting that the premise for processing a record is to read it out. Therefore, when processing the first record, you must read it and then process it. Therefore, it takes 2 MS + 4 ms to process R1. When R1 completes processing, the head has been transferred to the R4 position. to adjust it to the R2 position, you need to go through R5, R6, R7, R8, R9, R10, R1, this takes 16 ms, and 2 ms for reading R2 and 4 ms for processing data. The total processing time of R2 is 22 Ms. Therefore, 2 + 4 + (16 + 2 + 4) x 9 = 204 Ms. The optimized sorting order should be R1, R8, R5, R2, R9, R6, R3, R10, R7, and R4. The sorting order is exactly after R1 is processed, the head is at the R2 position. It reads R2 directly, processes R2, processes R2, and the head is at the R3 position. Accordingly, the reading and processing time of each record is as follows: 2 MS + 4 Ms = 6 ms, so the total time is: (2 + 4) * 10 = 60 ms.

 

Time when the disk reads data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.