compressed 16 x multibit trie Outline l l
compressed 16 -x multibit trie
Outline l l l 16 -X Compressed 16 -X Huang’s Algorithm
16 -X 13個0 . 1 0 陣列 4 ( 0000000100) 0 X y Binary tire轉為 16 -X 如下圖 共 65536格 Sementation table X . . . 2 y Fig. 16 -X結構
16 -X Search 共 走 16 個 bits 若search的IP為 64. 4. 224. 0 12 11個0後 17 14 先將IP以二進位表示 22 (01000000100 1110000000) X 取出前16 bits的值計算出為 16388, 即 讀取第一層array的16388位置 再以X node為root, 算其子樹的樹高, 得到樹高為 4 再取原IP後4 bits = 1110計算其值 得得為 13 , 即讀取第二層array的13 位置, return 28 32 高度為 4 28 128 共 65536格 16388 . . . X ………. . Next hop array 24 1110 1111 28 28 Prefix為 : 64. 12. 0 / 1 64. 3. 14. 0 / 14 64. 4. 32. 0 / 18 64. 4. 128. 0 / 20 192. 4. 63. 0 / 3 208. 18. 52. 0 / 4
Compressed 16 -X l 以 3 -bit Binary Tire為例 A B C Prefix為 ( * : don’t care) A: * B : 0* C : 01* D : 010* D Next hop array
l l Bitmap = 1 , while 指標往下展 or 和array前一個的值不一樣 Bitmap = 0 , while和array前一個的值一樣 000 Next hop array Bitmap Compressed Next hop array 100 111 B B D C A A 1 0 1 1 1 0 0 0 B D C A
Huang’s Algorithm l 原由: 因為在Compressed 16 -X方法中, 每次在 search一筆IP時, 總是要 計算bitmap中有幾個 1, 這樣會大大的降低performance
Base : 不含自己group以前, 出現幾個1 將bitmap分成數個group 每個group要存base值 不含自己group以前, 出現幾個1 每 4 bits為一個group, 由上排到下排的數字為bitmap , group , base Next hop array Bit map Group Base B C D A E
Search 1. 若search的IP為(1011……. . ……) IP開頭為 1011, 因此會access到上圖紅 圈部份, 取得其相關資訊 為Group 3, Base為 3, 以及自己Gourp的bitmap (1001) 2. 此時只要使用for loop 來算Group 3中有幾個1 , 再加base, 即為 整個bitmap 中是第幾個1, 藉此改善第三題Compressed 16 -X 3. base + count of Group 4’s bitmap = 5 因此access壓縮array中的第五個格, return E (上圖藍圈部份)
- Slides: 11