Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fan Qi Database Lab 1, com1 #01-08

Similar presentations


Presentation on theme: "Fan Qi Database Lab 1, com1 #01-08"— Presentation transcript:

1 Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08
CS3223 Midterm Solution Fan Qi Database Lab 1, com1 #01-08

2 Question 1 Clock Replacement Current: points to some buffer frame
Reference bit: turns on when its pin count becomes 0, turns off when checked by current Replacement: referenced bit off & pin count = 0 Dirty: it has been modified & not updated on disk

3 Question 1 3 1 2 Pin count:0 Refer: off Dirty: true Pin count:0
Pin count:0 Refer: off Dirty: true Pin count:0 Refer: on Dirty: false 3 1 Pin count:0 Refer: off Dirty: false 2 Pin count:1 Refer: off Dirty: true

4 Question 1 3 1 2 Pin count:0 Refer: off Dirty: true Pin count:0
Pin count:0 Refer: off Dirty: true Pin count:0 Refer: on Dirty: false 3 1 Pin count:0 Refer: off Dirty: false 2 Pin count:1 Refer: off Dirty: true

5 Question 1 3 1 2 Pin count:0 Refer: off Dirty: true Pin count:0
Pin count:0 Refer: off Dirty: true Pin count:0 Refer: on Dirty: false 3 1 Pin count:0 Refer: off Dirty: false 2 Pin count:1 Refer: off Dirty: true

6 Question 1 3 1 2 Pin count:0 Refer: off Dirty: true Pin count:0
Pin count:0 Refer: off Dirty: true Pin count:0 Refer: on Dirty: false 3 1 Pin count:0 Refer: off Dirty: false 2 Pin count:1 Refer: off Dirty: true

7 Question 2 A) 𝑇 𝑠 + 𝑇 𝑟 + 𝑇 𝑡 𝑇 𝑠 : average seek time
𝑇 𝑟 : rotational delay 𝑇 𝑡 : transmission time = 𝑠𝑖𝑧𝑒 𝑇 𝑑 B) 2× 𝑇 𝑠 + 𝑇 𝑟 + 𝑇 𝑡 What is 𝑇 𝑡 , 8 𝑇 𝑑 or 4 𝑇 𝑑 ? Minimal Unit of I/O is 1 block

8 Question 3 A) 𝑁 0 = 𝑁 24 B) 𝑙𝑜𝑔 7 ( 𝑁 24 )
Block size is 3, then memory has 8 blocks 1 block for output, 7 block for input 7-way merge: 𝑙𝑜𝑔 7 ( 𝑁 24 )

9 Question 4 L1 L2 L3 L4 L5 L6 L7

10 Question 4 Notice the bucket split After Insert 130,120

11 Question 5 A): any possible solution is accepted
Need to ensure to do trigger bucket split, before filling up buck 1 0,4,11,7,5,6 B): any possible solution is accepted Need to ensure to trigger two bucket split 0,4,6,11,7,5 C): next = 1 Step 1: look at the last bit of 8, it is in bucket 0 Step 2: bucket 0 has been split, look at second bit of 8, its in bucket 0 Step 3: bucket 0 is full, trigger bucket split on next

12 Question 6 A) false B) false C) false D) false E) false
𝑝=(x=10) ⋀ (y=20)⋀(z>30) , note I match 𝑝 indicates 𝐼 ≥ |𝑝| B) false 𝐼 𝑥𝑦𝑧 may be the cover index, 𝐼 𝑥𝑦 may need to do RID look up C) false if 𝐼 𝑥𝑦𝑧 and 𝐼 𝑥𝑦 both are not cover index, then 𝑁(𝐼 𝑥𝑦𝑧 ) >𝑁 𝐼 𝑥𝑦 D) false In the case 𝐼 𝑥𝑦 is also cover index, 𝑁(𝐼 𝑥𝑦𝑧 ) >𝑁 𝐼 𝑥𝑦 E) false 𝑝=(x=10) ⋀ (y>20) Data (10,11),(10,12),(10,30),(10,40) (10,30) (10,11) (10,12) (10,30) (10,40)

13 Thank you! See You Next Week!


Download ppt "Fan Qi Database Lab 1, com1 #01-08"

Similar presentations


Ads by Google