Presentation is loading. Please wait.

Presentation is loading. Please wait.

Storing Data Dina Said 1 1.

Similar presentations


Presentation on theme: "Storing Data Dina Said 1 1."— Presentation transcript:

1 Storing Data Dina Said 1 1

2 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. 2

3 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. 3

4 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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? 4

5 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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: 5

6 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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 × = 50, 000K What is the capacity of the disk? bytes/disk = bytes/surface× surfaces/disk = 50, 000K × 5 × 2 = 500, 000K 6

7 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided platters, and average seek time of 10 msec. How many cylinders does the disk have? 7

8 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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. 8

9 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided platters, and average seek time of 10 msec. Give examples of valid block sizes. Is 256 bytes a valid block size? 2048? 51200? 9

10 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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 is not a valid block size in this case because block size cannot exceed the size of a track, which is bytes. 10

11 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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? 11

12 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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 12

13 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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, seconds. 13

14 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided platters, and average seek time of 10 msec. /*Reward*/ If one track of data can be transferred per revolution, what is the transfer rate? 14

15 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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 15

16 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? 16

17 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. 17

18 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? 18

19 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. 19

20 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? 20

21 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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 × = 50, 000K What is the capacity of the disk? bytes/disk = bytes/surface× surfaces/disk = 50, 000K × 5 × 2 = 500, 000K 21

22 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? 22

23 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided platters, and average seek time of 10 msec. Image from: 23

24 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. 24

25 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 records of 100 bytes each can be stored using this disk?

26 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 records of 100 bytes each can be stored using this disk? The capacity of the disk is 500,000K, which has 500,000 blocks. Each block has 10 records. Therefore, the disk can store no more than 5,000,000 records.

27 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 records of 100 bytes each can be stored using this disk? The capacity of the disk is 500,000K, which has 500,000 blocks. Each block has 10 records. Therefore, the disk can store no more than 5,000,000 records.

28 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 pages are stored sequentially on disk, with page 1 on block 1 of track 1, what page is stored on block 1 of track 1 on the next disk surface? Remember that there are 25 blocks per track

29 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 pages are stored sequentially on disk, with page 1 on block 1 of track 1, what page is stored on block 1 of track 1 on the next disk surface? There are 25 blocks in each track. It is block 26 on block 1 of track 1 on the next disk surface.

30 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 would your answer change if the disk were capable of reading and writing from all heads in parallel?

31 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 would your answer change if the disk were capable of reading and writing from all heads in parallel? If the disk were capable of reading/writing from all heads in parallel, we can put the first 10 pages on the block 1 of track 1 of all 10 surfaces. Therefore, it is block 2 on block 1 of track 1 on the next disk surface.

32 Review - Time to access a block (access time)
- Seek time: Time taken to move the disk heads to the track on which this block is located - Rotational Delay: Waiting time for the block to rotate under the disk head (use the average time which is half of the maximum rotation) - Transfer time: time to actually read or write the data in the block (time for the disk to rotate over the block) Access time = seek time + Rotational Delay + Transfer Time

33 Review - Time to access a block (access time)
- Seek time: Time taken to move the disk heads to the track on which this block is located - Rotational Delay: Waiting time for the block to rotate under the disk head (use the average time which is half of the maximum rotational delay) - Transfer time: time to actually read or write the data in the block (time for the disk to rotate over the block) Access time = seek time + Rotational Delay + Transfer Time

34 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided 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, seconds. 34

35 Question 9.5 Consider a disk with a sector size of 512 bytes, tracks per surface, 50 sectors per track, five double- sided platters, and average seek time of 10 msec. 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 35

36 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. What time is required to read a file containing 100,000 records of 100 bytes each sequentially? Remember that the seek time is 0.01 mseconds

37 Question 9.6 What time is required to read a file containing 100,000 records of 100 bytes each sequentially? Access time = seek time + Rotational Delay + Transfer Time A track can be read/written in one rotation → Transfer Time = no of tracks * time of one rotation Since we have 400 tracks, Transfer Time is 400 × = 4.4 seconds Sequential Access → We don't need rotational delay

38 Question 9.6 What time is required to read a file containing 100,000 records of 100 bytes each sequentially? – Seek time is the time to locate the tracks → Seek time of the file = no Of Cylinders * seek time of track. - The seek time is 40 × 0.01 = 0.4seconds. - Therefore, total access time is = 4.8 seconds.

39 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. Again, how would your answer change if the disk were capable of reading/writing from all heads in parallel (and the data was arranged optimally)?

40 Question 9.6 Again, how would your answer change if the disk were capable of reading/writing from all heads in parallel (and the data was arranged optimally)? If the disk were capable of reading/writing from all heads in parallel, the disk can read 10 tracks at a time. The transfer time is 10 times less, which is 0.44 seconds. Thus total access time is = 0.84seconds

41 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. What is the time required to read a file containing 100,000 records of 100 bytes each in a random order? To read a record, the block containing the record has to be fetched from disk. Assume that each block request incurs the average seek time and rotational delay.

42 Question 9.6 What is the time required to read a file containing 100,000 records of 100 bytes each in a random order? To read a record, the block containing the record has to be fetched from disk. Assume that each block request incurs the average seek time and rotational delay. Access time = Seek time + Rotational Delay + Transfer Time. The average access time for a block of data would be msec. For a file containing 10,000 blocks, the total access time would be seconds.


Download ppt "Storing Data Dina Said 1 1."

Similar presentations


Ads by Google