Storing Data Dina Said 1 Question 9.4 If you have a large file that is frequently scanned sequentially, explain how you would store the pages in the file on a disk. Question 9.4 If you have a large file that is frequently scanned sequentially, explain how you would store the pages in the file on a disk. The pages in the file should be stored ‘sequentially’ on a disk. We should put two ‘logically’ adjacent pages as close as possible. In decreasing order of closeness, they could be on the same track, the same cylinder, or an adjacent cylinder. Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. What is the capacity of a track in bytes? What is the capacity of each surface? What is the capacity of the disk? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. What is the capacity of a track in bytes? What is the capacity of each surface? What is the capacity of the disk? Image from: http://pushypanda.blogspot.ca/2011/01/keeping-up-with-hard-times.html Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. What is the capacity of a track in bytes? bytes/track = bytes/sector × sectors/track = 512 × 50 = 25K What is the capacity of each surface? bytes/surface = bytes/track × tracks/surface = 25K × 2000 = 50, 000K What is the capacity of the disk? bytes/disk = bytes/surface× surfaces/disk = 50, 000K × 5 × 2 = 500, 000K Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. How many cylinders does the disk have? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. How many cylinders does the disk have? The number of cylinders is the same as the number of tracks on each platter, which is 2000. Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. Give examples of valid block sizes. Is 256 bytes a valid block size? 2048? 51200? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. Give examples of valid block sizes. Is 256 bytes a valid block size? 2048? 51200? The block size should be a multiple of the sector size. We can see that 256 is not a valid block size while 2048 is. 51200 is not a valid block size in this case because block size cannot exceed the size of a track, which is 25600 bytes. Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. If the disk platters rotate at 5400 rpm (revolutions per minute), what is the maximum rotational delay? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. If the disk platters rotate at 5400 rpm (revolutions per minute), what is the maximum rotational delay? If the disk platters rotate at 5400rpm, the time required for one complete rotation, which is the maximum rotational delay, is 1/5400 × 60 = 0.011seconds Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. If the disk platters rotate at 5400 rpm (revolutions per minute), what is the maximum rotational delay? If the disk platters rotate at 5400rpm, the time required for one complete rotation, which is the maximum rotational delay, is 1/5400 × 60 = 0.011seconds The average rotational delay is half of the rotation time, 0.006 seconds. Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. /*Reward*/ If one track of data can be transferred per revolution, what is the transfer rate? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. /*Reward*/ If one track of data can be transferred per revolution, what is the transfer rate? The capacity of a track is 25K bytes. Since one track of data can be transferred per revolution, the data transfer rate is 25K/ 0.011= 2, 250Kbytes/second Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. 1. How many records fit onto a block? Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. 1. How many records fit onto a block? 1024/100 = 10. We can have at most 10 records in a block. Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. How many blocks are required to store the entire file? Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. How many blocks are required to store the entire file? we need 10,000 blocks to store the file. Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. If the file is arranged sequentially on the disk, how many surfaces are needed? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. What is the capacity of a track in bytes? bytes/track = bytes/sector × sectors/track = 512 × 50 = 25K What is the capacity of each surface? bytes/surface = bytes/track × tracks/surface = 25K × 2000 = 50, 000K What is the capacity of the disk? bytes/disk = bytes/surface× surfaces/disk = 50, 000K × 5 × 2 = 500, 000K Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. If the file is arranged sequentially on the disk, how many surfaces are needed? One track has 25 blocks, one surface has 25*2000=100,000 blocks. we need 10,000 blocks to store this file. So we need less than one surface to store this file. Is it correct? Question 9.5 Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, five doublesided platters, and average seek time of 10 msec. Image from: http://gerardnico.com/wiki/data_storage/disk Question 9.6 Consider again the disk specifications from Exercise 9.5, and suppose that a block size of 1024 bytes is chosen. Suppose that a file containing 100,000 records of 100 bytes each is to be stored on such a disk and that no record is allowed to span two blocks. If the file is arranged sequentially on the disk, how many surfaces are needed? One track has 25 blocks, One cylindar has 25*5*2=250 blocks. we need 10,000 blocks to store this file. So we need 10,000/250 = 40 cylindars, i.e. We will need the 10 surfaces to store the file.