复习题(2)
1、 试分别判断下列图中G1和G2是否互模拟(bisimulation),并说明理由:
答案:
(1) 在图中标出各点的状态,我们构造关系
,
可知G2可以模拟G1,下面我们讨论
是否可模拟,在G2中有一个a变换可对应到G1中2个变换,即,。但休斯顿大学有两个变换b,c,而在G1中仅存在只有b或只有c的状态点,可知G1和G2不能互模拟。
galfan
(2) 如图,标出各状态点,构造有关系
可知其中G1中的点均可由G2中的点模拟,下面我们考虑
可知同样其中G2中的点均可由G1中的点模拟. 所以G1和G2为互模拟的。
2、 给定如下数据图(Data Graph):
试给出其Strong DataGuide 图
答案:
Strong DataGuide 图
3、 Consider the relation, r fabricate, shown in Figure 5.27. Give the result of the following query :
Figure 5.27
Query 1:
lect building, room number, time_slo_ id, count(*)
from r
group by rollup (building, room number, time_slo_ id)
Query 1:
lect building, room number, time_slo_ id, count(*)
from r
group by cube (building, room number, time_slo_ id)
答案:
Query 1
返回结果集:为以下四种分组统计结果集的并集且未去掉重复数据。
building | room number | time_slo_ id | count(*) |
产生的分组种数:4种; 第一种:group by A,B,C |
Garfield | 359 | A | 1 |
Garfield | 359wolf是什么意思 | B | 1 |
Saucon | 651 | A | 1 |
fortuneSaucon | 550 | C | 1 |
Painter | 705 | D | 1 |
初二英语辅导Painter | 403 | D | 1 |
第二种:group by A,B |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 2 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 1 |
Painter | 403 | D | 1 |
第三种:group by A |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 2 |
Saucon | 651 | A | 2 |
Saucon | 550 | C | 2 |
Painter | 705 | D | 2 |
Painter | 403 | D | 2 |
第四种:group by NULL。本没有group by NULL 的写法,在这里指是为了方便说明,而采用之。含义是:没有分组,也就是所有数据做一个统计。例如聚合函数是SUM的话,那就是对所有满足条件的数据进行求和。 |
Garfield | 359 | A | 6 |
Garfield | 359 | B | 6 |
Saucon | 651 | A | 6 |
Saucon | 550 | C | 6 |
Painter | 705 | D | 6 |
Painter | 403 | D | 6 |
| | | |
Query 2:
group by后带rollup子句与group by后带cube子句的唯一区别就是:
带cube子句的group by会产生更多的分组统计数据。cube后的列有多少种组合(注意组合是与顺序无关的)就会有多少种分组。
返回结果集:为以下八种分组统计结果集的并集且未去掉重复数据。
building | room number | time_slo_ id | count(*) |
产生的分组种数:8种 第一种:group by A,B,C |
Garfield | 359 | A | 1 |
Garfield | 359 | B | 1 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 1 |
Painter | 403 | D | 1 |
第二种:group by A,B |
Garfield | 359 | A | 2 |
Garfield | 359 | 说明方法B | 2 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 1 |
Painter | 403 | D | 1 |
第三种:group by A,C |
Garfield | 359 | A | 1 |
Garfield | 359 | B | 1 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 2 |
Painter | 403 | D | 2 |
第四种:group by B,C |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 2 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 1 |
Painter | 403 | D | 1 |
第五种:group by A |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 2 |
Saucon | 651 | A | 2 |
sounorSaucon | 550 | C | 2 |
Painter | 705 | 烛台背后D | 2 |
Painter | 403 | D | 2 |
第六种:group by B |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 2 |
Saucon | 651 | A | 1 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 1 |
Painter | 403 | D | 1 |
第七种:group by C |
Garfield | 359 | A | 2 |
Garfield | 359 | B | 1 |
Saucon | 651 | A | 2 |
Saucon | 550 | C | 1 |
Painter | 705 | D | 2 |
Painter | 403 | D | 2 |
第八种:group by NULL |
Garfield | 359 | A | 6 |
Garfield | 359 | B | 6 |
Saucon | 651 | A | 6 |
Saucon | 550 | C | 6 |
Painter | 705 | D | 6 |
Painter | 403 | D | 6 |
| | | |
4、 [Disks and Access Time]Consider a disk with a ctor扇区 size of 512 bytes, 63 ctors per track磁道, 16,383 tracks per surface盘面, 8 double-sided platters柱面 (i.e., 16 surfaces). The disk platters rotate at 7,200 rpm (revolutions per minute). The average ek time is 9 mc, whereas the track-to-track ek time is 1 mc.
Suppo that a page size of 4096 bytes is chon. Suppo that a file containing 1,000,000 records of 256 bytes each is to be stored on such a disk. No record is allowed to span two pages (u the numbers in appropriate places in your calculation).
(a) What is the capacity of the disk?
(b) If the file is arranged quentially on the disk, how many cylinders are needed?
(c) How much time is required to read this file quentially?
(d) How much time is needed to read 10% of the pages in the file randomly?
Answer:
(a) Capacity = ctor size * num. of ctors per track * num. of tracks per surface * num of surfaces = 512 * 63 * 16383 * 16 = 8 455 200 768
(b) File: 1,000,000 records of 256 bytes each
Num of records per page: 4096/256 = 16
1,000,000/ 16 = 62,500 pages or 62,500 * 8 = 500,000 ctors
Each cylinder has 63 * 16 = 1,008 ctors
one timeSo we need 496.031746 cylinders.
(c) We analyze the cost using the following three components:
Seek time: This access eks the initial position of the file (who cost can be approximated using the average ek time) and then eks between adjacent tracks 496 times (who cost is the track-to-track ek time). So the ek time is 0.009 + 496*0.001 = 0.505 conds.
Rotational delay:
The transfer time of one track of data is 1/ (7200/60) = 0.0083 conds.
For this question, we u 0.0083/2 as an estimate of the rotational delay (other numbers between 0 and 0.00415 are also fine). So the rotational delay for 497 eks is 0.00415 * 497 = 2.06255.