数据库系统实现(第二版_英文版)部分答案
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Cylinder First time E Seek F Seek FCFS Elevator E Rank FCFS of request available time time Rank 8,000 48,000 4,000 40,000 0 1 10 20 3 11 3 10 7.3 22.6 29.9 44.2 1 2 4 3 3 11 12 10 7.3 22.6 38.9 53.2 1 2 3 4
⌈n/(50×80%)⌉blocks are needed for the data file, and ⌈n/(500×80%)⌉ for the index, for a total of ⌈n/40⌉ + ⌈n/400⌉ blocks. We again need ⌈n/(50×80%)⌉for the data file, but now need only room for ⌈n/(50×80%) /(500×80%)⌉pointers in the index file. The latter takes ⌈n/16000⌉blocks, for a total of ⌈n/40⌉+ ⌈n/16000⌉ blocks.
The
average tracks the heads have to move: [(1+2+……+4095)+(1+2+……(65536-4096)]/65536≈28928
1
Seek
4096
65536
time: 1+28928/4000=8.232ms Transfer time = 0.13ms Rotational latency = 4.17ms Average seek time + average rotational latency +average transfer time = 12.532ms
Data disks Disk 1 1 Disk 2 1 Disk 3 1 Disk 4 0 Disk 5 1
Redundant Disk 6 0 Disk 7 0
1
1 Disk 1 2 3 4 5 6 7 Contents 00110100 11100111 01010101 10000100 10000110 01010111 11100101
Exercise 13.5.3(3.2.2)
8+25+1+10 = 44 bytes 8+32+8+16 = 64 bytes 8+28+4+12 = 52 bytes
Exercise 13.6.5(3.3.4)
IP address 4×8=32bits=4B Device number 14 bits=2B (as 213<10,000<214) Block address 4+16+6=26bits=4B (because there are 24 surfaces, 216 tracks and 26 blocks, see P564.) So, totally require 10B.
b)
c)
Obtain all the bucket entries for “dog”. Sort these by position. Scan the records, keeping a “window” with records of one position prior to the current position. Compare each new record with the records in the window. If we find one that: (1) has the opposite word “cat”, and (2) have identical document entries. Then the common document is one of those we want to retrieve. We follow the pointer associated with “cat” to find the occurrences of this word. Select from the bucket file the pointers to documents associated with occurrences of “cat” where the type is “title”. Then we find the bucket entries for “dog”, and Select from the bucket file the pointers to documents associated with occurrences of “cat” where the type is “title” intersect this two sets of pointers, we can have the documents that meet the conditions.
The first three fields need 9×3=27Byte. And the first variable-length field does not need a pointer, while the second one and the third one need pointers. So there are 8×2=16Byte for pointers, and every record takes 27+16=43Byte. Since the length of a record is a 2-byte integer, the record has 45Byte.
a) 块传输时间为0.13ms,平均旋转等待时间为4.17ms,平 均寻道时间为1+65536/(3×4000×2)= 3.72ms,所以 平均读取一个块的时间为8.02ms b) 无约束的megatron镜像平均速度提高1倍,所以平均读 取时间约为10.76/2 = 5.38ms c) 该系统缺陷主要在于无法同时处理同侧柱面的读取请求, 大量同侧请求到来时会导致一边队列累积而另一边空闲
Gan Lin QQ: 85906478 Email: 85906478@
a) The capacity of the disk? The disk has 8 × 100,000 = 800,000 tracks. The average track has 2000 × 1024 = 2048,000 bytes. Thus, the capacity is 214 × 108 bytes b) The maximum seek time? The maximum seek time occurs when the heads have to move across all the tracks. Thus, substitute 100,000 tracts (really 99999) for n in the formula 1+.0003n to get 31(30.9997)ms.
a) Obtain all the bucket entries for “cat” and “dog”. Sort these by type, and within type, by position. Scan the records, keeping a “window” with records of the current type, extending up to five positions prior to the current type. Compare each new record with the records in the window. If we find one that: (1) Has the opposite word, e.g. “dog” if the current bucket record has “cat”, and (2) Have identical document entries. Then the common document is one of those we want to retrieve.
c) The maximum rotational latency? The maximum rotational latency is one full revolution. Since the disk rotates at 6,000 rpm, it takes 1/6000 of a minute, or 0.01s to rotate.
0
0
1
1
1
0
0
1
0 Disk 1 2 3 4 5 6 7
0
1 Contents 00110100 11100111 01111111 10000100 10101100 01010111 11001111
Modulo-2 sum of the new value 01111111 and the old value 01010101 is 00101010
Seek time = 1+ tracks/4000 Transfer time = 0.13 Rotational latency = 4.17 Complete time = deal time + seek time + transfer time + rotational latency
e) The average seek time? The average n is tracks/3 of a surface, i.e. 100,000/3. So the average seek time is 1+.0003×n =1+.0003×100,000/3=11ms. f) The average rotational latency? The average rotational latency is 0.01/2 = 0.005s
d) Transfer time of a block? Since a track has 2000 sectors and 2000 gaps, and 10% of a track is used for gaps, there are 36o for gaps and 324o for sectors of a track circle. So there are 36o/2000 for each gap and 324o/2000 for each sector. This block is 65546 bytes (i.e. 64 sectors), the heads must therefore pass over 63 gaps and 64 gaps, i.e. 63×36o/2000 + 64×324o/2000. As the maximum rotational latency is 0.01s, we can have the transfer time of the block is (63×36o/2000 + 64×324o/2000) ×0.01/360 o= 0.0003195s or 0.3195ms.
g) The average density of bits in the sectors of a outer track? A track has 2000 sectors, each sector holds 1024 bytes, and every byte takes 8 bits, so a track is 2000×1024×8 bits. For the 3.5 inch disk, the density of the outer track is 2000×1024×8/ (3.5 × π × 90%) = 1655615.6394 bit/inch.
⌈n/(50×80%)⌉blocks are needed for the data file, and ⌈n/(500×80%)⌉ for the index, for a total of ⌈n/40⌉ + ⌈n/400⌉ blocks. We again need ⌈n/(50×80%)⌉for the data file, but now need only room for ⌈n/(50×80%) /(500×80%)⌉pointers in the index file. The latter takes ⌈n/16000⌉blocks, for a total of ⌈n/40⌉+ ⌈n/16000⌉ blocks.
The
average tracks the heads have to move: [(1+2+……+4095)+(1+2+……(65536-4096)]/65536≈28928
1
Seek
4096
65536
time: 1+28928/4000=8.232ms Transfer time = 0.13ms Rotational latency = 4.17ms Average seek time + average rotational latency +average transfer time = 12.532ms
Data disks Disk 1 1 Disk 2 1 Disk 3 1 Disk 4 0 Disk 5 1
Redundant Disk 6 0 Disk 7 0
1
1 Disk 1 2 3 4 5 6 7 Contents 00110100 11100111 01010101 10000100 10000110 01010111 11100101
Exercise 13.5.3(3.2.2)
8+25+1+10 = 44 bytes 8+32+8+16 = 64 bytes 8+28+4+12 = 52 bytes
Exercise 13.6.5(3.3.4)
IP address 4×8=32bits=4B Device number 14 bits=2B (as 213<10,000<214) Block address 4+16+6=26bits=4B (because there are 24 surfaces, 216 tracks and 26 blocks, see P564.) So, totally require 10B.
b)
c)
Obtain all the bucket entries for “dog”. Sort these by position. Scan the records, keeping a “window” with records of one position prior to the current position. Compare each new record with the records in the window. If we find one that: (1) has the opposite word “cat”, and (2) have identical document entries. Then the common document is one of those we want to retrieve. We follow the pointer associated with “cat” to find the occurrences of this word. Select from the bucket file the pointers to documents associated with occurrences of “cat” where the type is “title”. Then we find the bucket entries for “dog”, and Select from the bucket file the pointers to documents associated with occurrences of “cat” where the type is “title” intersect this two sets of pointers, we can have the documents that meet the conditions.
The first three fields need 9×3=27Byte. And the first variable-length field does not need a pointer, while the second one and the third one need pointers. So there are 8×2=16Byte for pointers, and every record takes 27+16=43Byte. Since the length of a record is a 2-byte integer, the record has 45Byte.
a) 块传输时间为0.13ms,平均旋转等待时间为4.17ms,平 均寻道时间为1+65536/(3×4000×2)= 3.72ms,所以 平均读取一个块的时间为8.02ms b) 无约束的megatron镜像平均速度提高1倍,所以平均读 取时间约为10.76/2 = 5.38ms c) 该系统缺陷主要在于无法同时处理同侧柱面的读取请求, 大量同侧请求到来时会导致一边队列累积而另一边空闲
Gan Lin QQ: 85906478 Email: 85906478@
a) The capacity of the disk? The disk has 8 × 100,000 = 800,000 tracks. The average track has 2000 × 1024 = 2048,000 bytes. Thus, the capacity is 214 × 108 bytes b) The maximum seek time? The maximum seek time occurs when the heads have to move across all the tracks. Thus, substitute 100,000 tracts (really 99999) for n in the formula 1+.0003n to get 31(30.9997)ms.
a) Obtain all the bucket entries for “cat” and “dog”. Sort these by type, and within type, by position. Scan the records, keeping a “window” with records of the current type, extending up to five positions prior to the current type. Compare each new record with the records in the window. If we find one that: (1) Has the opposite word, e.g. “dog” if the current bucket record has “cat”, and (2) Have identical document entries. Then the common document is one of those we want to retrieve.
c) The maximum rotational latency? The maximum rotational latency is one full revolution. Since the disk rotates at 6,000 rpm, it takes 1/6000 of a minute, or 0.01s to rotate.
0
0
1
1
1
0
0
1
0 Disk 1 2 3 4 5 6 7
0
1 Contents 00110100 11100111 01111111 10000100 10101100 01010111 11001111
Modulo-2 sum of the new value 01111111 and the old value 01010101 is 00101010
Seek time = 1+ tracks/4000 Transfer time = 0.13 Rotational latency = 4.17 Complete time = deal time + seek time + transfer time + rotational latency
e) The average seek time? The average n is tracks/3 of a surface, i.e. 100,000/3. So the average seek time is 1+.0003×n =1+.0003×100,000/3=11ms. f) The average rotational latency? The average rotational latency is 0.01/2 = 0.005s
d) Transfer time of a block? Since a track has 2000 sectors and 2000 gaps, and 10% of a track is used for gaps, there are 36o for gaps and 324o for sectors of a track circle. So there are 36o/2000 for each gap and 324o/2000 for each sector. This block is 65546 bytes (i.e. 64 sectors), the heads must therefore pass over 63 gaps and 64 gaps, i.e. 63×36o/2000 + 64×324o/2000. As the maximum rotational latency is 0.01s, we can have the transfer time of the block is (63×36o/2000 + 64×324o/2000) ×0.01/360 o= 0.0003195s or 0.3195ms.
g) The average density of bits in the sectors of a outer track? A track has 2000 sectors, each sector holds 1024 bytes, and every byte takes 8 bits, so a track is 2000×1024×8 bits. For the 3.5 inch disk, the density of the outer track is 2000×1024×8/ (3.5 × π × 90%) = 1655615.6394 bit/inch.