📄 hash_usenix.ps
字号:
3124(a)X3203(singular,)X3524(non-sparse)X2 f8 s3872 1890(4)N1 f10 s3947 1915(\256le.)N4112(The)X4280(gdbm)X2706 2003(library)N2947(also)X3103(includes)X2 f3396(dbm)X1 f3560(and)X2 f3702(ndbm)X1 f3906(compatible)X4288(inter-)X2706 2091(faces.)N2878 2205(The)N3025(gdbm)X3229(library)X3465(is)X3540(based)X3745(on)X2 f3847(extensible)X4189(hashing)X1 f4442(,)X2706 2293(a)N2766(dynamic)X3066(hashing)X3339(algorithm)X3674(by)X3778(Fagin)X3984(et)X4066(al)X4148([FAG79].)X2706 2381(This)N2881(algorithm)X3225(differs)X3467(from)X3655(the)X3785(previously)X4155(discussed)X2706 2469(algorithms)N3069(in)X3152(that)X3293(it)X3358(uses)X3517(a)X2 f3574(directory)X1 f3889(that)X4030(is)X4103(a)X4159(collapsed)X2706 2557(representation)N3192([ENB88])X3517(of)X3615(the)X3744(radix)X3940(search)X4177(trie)X4315(used)X2706 2645(by)N2 f2806(sdbm)X1 f2975(.)X10 f2706 2733 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN3 f7 s3572 3761(L1)N1 Dt3485 3738 MXY-20 -13 Dl7 13 Dl-7 13 Dl20 -13 Dl-400 0 Dl3180 3027 MXY136 Dc2706 3494 MXY136 Dc2950 3264 MXY136 Dc3738 MY136 Dc3485 2968 MXY0 118 Dl238 0 Dl0 -118 Dl-238 0 Dl3442 MY0 119 Dl238 0 Dl0 -119 Dl-238 0 Dl3679 MY0 119 Dl238 0 Dl0 -119 Dl-238 0 Dl3187 3501 MXY136 Dc2963 3316 MXY-24 5 Dl15 4 Dl4 15 Dl5 -24 Dl-137 134 Dl3204 3083 MXY-24 5 Dl15 4 Dl3 14 Dl6 -23 Dl-137 133 Dl3204 3450 MXY-6 -24 Dl-3 14 Dl-15 5 Dl24 5 Dl-137 -134 Dl2842 3369(0)N3075 3139(0)N2842 3676(1)N3075 3443(1)N3562 3054(L00)N3565 3528(L01)N4197 2968 MXY0 118 Dl237 0 Dl0 -118 Dl-237 0 Dl3205 MY0 119 Dl237 0 Dl0 -119 Dl-237 0 Dl3561 MY0 118 Dl237 0 Dl0 -118 Dl-237 0 Dl3960 2909 MXY0 237 Dl118 0 Dl0 -237 Dl-118 0 Dl3146 MY0 237 Dl118 0 Dl0 -237 Dl-118 0 Dl3383 MY0 237 Dl118 0 Dl0 -237 Dl-118 0 Dl3620 MY0 237 Dl118 0 Dl0 -237 Dl-118 0 Dl4197 3027 MXY-21 -13 Dl8 13 Dl-8 13 Dl21 -13 Dl-119 0 Dl4197 3264 MXY-21 -13 Dl8 13 Dl-8 13 Dl21 -13 Dl-119 0 Dl3501 MY59 0 Dl0 89 Dl4078 3738 MXY59 0 Dl0 -88 Dl4197 3590 MXY-21 -13 Dl8 13 Dl-8 13 Dl21 -13 Dl-60 0 Dl4197 3650 MXY-21 -13 Dl8 13 Dl-8 13 Dl21 -13 Dl-60 0 Dl3991 3050(00)N3991 3287(01)N3991 3524(10)N3991 3761(11)N4269 3050(L00)N4269 3287(L01)N4283 3643(L1)N3485 3501 MXY-20 -13 Dl7 13 Dl-7 13 Dl20 -13 Dl-155 0 Dl3485 3027 MXY-20 -13 Dl7 13 Dl-7 13 Dl20 -13 Dl-163 0 Dl2967 3687 MXY-5 -24 Dl-4 14 Dl-15 4 Dl24 6 Dl-141 -141 Dl3 Dt-1 Ds8 s2706 4033(Figure)N2903(2:)X1 f2972(A)X3034(radix)X3181(search)X3359(trie)X3460(and)X3568(a)X3612(directory)X3858(representing)X4189(the)X4283(trie.)X10 s10 f2706 4209 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN1 f2878 4411(In)N2968(this)X3106(algorithm,)X3460(a)X3519(directory)X3832(consists)X4108(of)X4198(a)X4256(search)X2706 4499(trie)N2847(of)X2947(depth)X2 f3158(n)X1 f3211(,)X3264(containing)X3635(2)X2 f7 s4467(n)Y10 s1 f3749 4499(bucket)N3996(addresses)X4337(\(i.e.)X2706 4587(each)N2897(element)X3194(of)X3304(the)X3445(trie)X3594(is)X3689(a)X3767(bucket)X4023(address\).)X4373(To)X2706 4675(access)N2935(the)X3056(hash)X3226(table,)X3425(a)X3483(32-bit)X3696(hash)X3865(value)X4061(is)X4136(calculated)X2706 4763(and)N2 f2861(n)X1 f2953(bits)X3107(of)X3213(the)X3350(value)X3563(are)X3701(used)X3886(to)X3986(index)X4202(into)X4364(the)X2706 4851(directory)N3018(to)X3102(obtain)X3324(a)X3382(bucket)X3618(address.)X3921(It)X3992(is)X4067(important)X4400(to)X2706 4939(note)N2866(that)X3008(multiple)X3296(entries)X3532(of)X3620(this)X3756(directory)X4067(may)X4226(contain)X2706 5027(the)N2833(same)X3026(bucket)X3268(address)X3537(as)X3632(a)X3696(result)X3902(of)X3997(directory)X4315(dou-)X2706 5115(bling)N2903(during)X3145(bucket)X3392(splitting.)X3706(Figure)X3948(2)X4021(illustrates)X4364(the)X2706 5203(relationship)N3126(between)X3436(a)X3513(typical)X3772(\(skewed\))X4108(search)X4355(trie)X2706 5291(and)N2850(its)X2953(directory)X3271(representation.)X3774(The)X3927(formation)X4270(of)X4364(the)X2706 5379(directory)N3016(shown)X3245(in)X3327(the)X3445(\256gure)X3652(is)X3725(as)X3812(follows.)X16 s2706 5593 MXY864 0 Dl2 f8 s2746 5648(4)N1 f9 s2796 5673(It)N2858(does)X3008(not)X3118(contain)X3348(holes.)X3 f10 s720 5960(USENIX)N9 f1042(-)X3 f1106(Winter)X1371('91)X9 f1498(-)X3 f1562(Dallas,)X1815(TX)X4424(3)X4 p%%Page: 4 40(Courier)xf 0 f10 s 10 xH 0 xS 0 f3 f432 258(A)N510(New)X682(Hashing)X985(Package)X1290(for)X1413(UNIX)X3663(Seltzer)X3920(&)X4007(Yigit)X1 f604 538(Initially,)N937(there)X1158(is)X1271(one)X1446(slot)X1620(in)X1741(the)X1898(directory)X432 626(addressing)N802(a)X865(single)X1083(bucket.)X1364(The)X1515(depth)X1719(of)X1812(the)X1936(trie)X2069(is)X2148(0)X432 714(and)N577(0)X646(bits)X790(of)X886(each)X1063(hash)X1239(value)X1442(are)X1570(examined)X1910(to)X2000(deter-)X432 802(mine)N624(in)X718(which)X946(bucket)X1192(to)X1286(place)X1488(a)X1556(key;)X1726(all)X1837(keys)X2015(go)X2126(in)X432 890(bucket)N682(0.)X797(When)X1024(this)X1174(bucket)X1423(is)X1511(full,)X1677(its)X1787(contents)X2089(are)X432 978(divided)N698(between)X992(L0)X1107(and)X1249(L1)X1363(as)X1455(was)X1605(done)X1786(in)X1873(the)X1996(previ-)X432 1066(ously)N664(discussed)X1030(algorithms.)X1471(After)X1700(this)X1874(split,)X2090(the)X432 1154(address)N710(of)X814(the)X948(second)X1207(bucket)X1457(must)X1648(be)X1760(stored)X1992(in)X2090(the)X432 1242(directory.)N796(To)X939(accommodate)X1438(the)X1589(new)X1776(address,)X2090(the)X432 1330(directory)N752(is)X835(split)X2 f8 s972 1305(5)N1 f10 s1330(,)Y1054(by)X1163(doubling)X1476(it,)X1569(thus)X1731(increasing)X2090(the)X432 1418(depth)N630(of)X717(the)X835(directory)X1145(by)X1245(one.)X604 1532(After)N813(this)X967(split,)X1163(a)X1237(single)X1466(bit)X1588(of)X1693(the)X1829(hash)X2014(value)X432 1620(needs)N663(to)X773(be)X896(examined)X1255(to)X1364(decide)X1621(whether)X1927(the)X2072(key)X432 1708(belongs)N711(to)X803(L0)X922(or)X1019(L1.)X1158(Once)X1358(one)X1504(of)X1601(these)X1795(buckets)X2069(\256lls)X432 1796(\(L0)N578(for)X702(example\),)X1051(it)X1125(is)X1208(split)X1375(as)X1472(before,)X1728(and)X1873(the)X2000(direc-)X432 1884(tory)N585(is)X662(split)X823(again)X1021(to)X1107(make)X1305(room)X1498(for)X1615(the)X1736(address)X2000(of)X2090(the)X432 1972(third)N618(bucket.)X927(This)X1104(splitting)X1400(causes)X1645(the)X1778(addresses)X2121(of)X432 2060(the)N567(non-splitting)X1012(bucket)X1263(\(L1\))X1443(to)X1541(be)X1653(duplicated.)X2063(The)X432 2148(directory)N766(now)X948(has)X1099(four)X1277(entries,)X1555(a)X1635(depth)X1857(of)X1968(2,)X2072(and)X432 2236(indexes)N700(the)X821(buckets)X1089(L00,)X1261(L01)X1413(and)X1552(L1,)X1684(as)X1774(shown)X2006(in)X2090(the)X432 2324(Figure)N661(2.)X604 2438(The)N756(crucial)X1002(part)X1154(of)X1247(the)X1371(algorithm)X1708(is)X1787(the)X1911(observa-)X432 2526(tion)N580(that)X724(L1)X837(is)X914(addressed)X1255(twice)X1453(in)X1539(the)X1661(directory.)X1995(If)X2073(this)X432 2614(bucket)N679(were)X869(to)X964(split)X1134(now,)X1324(the)X1454(directory)X1776(already)X2045(con-)X432 2702(tains)N611(room)X808(to)X898(hold)X1067(the)X1192(address)X1460(of)X1554(the)X1679(new)X1840(bucket.)X2121(In)X432 2790(general,)N711(the)X831(relationship)X1231(between)X1521(the)X1641(directory)X1953(and)X2090(the)X432 2878(number)N704(of)X798(bucket)X1039(addresses)X1374(contained)X1713(therein)X1962(is)X2041(used)X432 2966(to)N517(decide)X750(when)X947(to)X1031(split)X1190(the)X1310(directory.)X1662(Each)X1845(bucket)X2081(has)X432 3054(a)N505(depth,)X740(\()X2 f767(n)X7 s3070(b)Y10 s1 f848 3054(\),)N932(associated)X1299(with)X1478(it)X1558(and)X1710(appears)X1992(in)X2090(the)X432 3142(directory)N744(exactly)X998(2)X2 f7 s3106(n)Y9 f1075(-)X2 f1106(n)X4 s3110(b)Y7 s1 f10 s1181 3142(times.)N1396(When)X1610(a)X1668(bucket)X1904(splits,)X2113(its)X432 3230(depth)N638(increases)X961(by)X1069(one.)X1253(The)X1406(directory)X1724(must)X1907(split)X2072(any)X432 3318(time)N602(a)X665(bucket's)X964(depth)X1169(exceeds)X1451(the)X1576(depth)X1781(of)X1875(the)X2000(direc-)X432 3406(tory.)N630(The)X784(following)X1123(code)X1303(fragment)X1621(helps)X1818(to)X1908(illustrate)X432 3494(the)N554(extendible)X912(hashing)X1185(algorithm)X1520([FAG79])X1838(for)X1955(access-)X432 3582(ing)N554(individual)X898(buckets)X1163(and)X1299(maintaining)X1701(the)X1819(directory.)X0 f8 s432 3881(hash)N622(=)X698 -0.4038(calchash\(key\);)AX432 3969(mask)N622(=)X698 -0.4018(maskvec[depth];)AX432 4145(bucket)N698(=)X774 -0.4038(directory[hash)AX1344(&)X1420(mask];)X432 4321(/*)N546(Key)X698 -0.4219(Insertion)AX1078(*/)X432 4409(if)N546 -0.4038(\(store\(bucket,)AX1116(key,)X1306(data\))X1534(==)X1648(FAIL\))X1876({)X720 4497(newbl)N948(=)X1024 -0.4167(getpage\(\);)AX720 4585 -0.4000(bucket->depth++;)AN720 4673 -0.4091(newbl->depth)AN1214(=)X1290 -0.4038(bucket->depth;)AX720 4761(if)N834 -0.4038(\(bucket->depth)AX1404(>)X1480(depth\))X1746({)X1008 4849(/*)N1122(double)X1388 -0.4219(directory)AX1768(*/)X1008 4937(depth++;)N1 f16 s432 5033 MXY864 0 Dl2 f8 s472 5088(5)N1 f9 s534 5113(This)N692(decision)X962(to)X1048(split)X1202(the)X1319(directory)X1608(is)X1685(based)X1878(on)X1979(a)X2040(com-)X432 5193(parison)N666(of)X748(the)X858(depth)X1040(of)X1121(the)X1230(page)X1387(being)X1568(split)X1713(and)X1838(the)X1947(depth)X2128(of)X432 5273(the)N543(trie.)X698(In)X781(Figure)X992(2,)X1069(the)X1180(depths)X1390(of)X1472(both)X1622(L00)X1760(and)X1886(L01)X2024(are)X2134(2,)X432 5353(whereas)N689(the)X798(depth)X979(of)X1060(L1)X1161(is)X1230(1.)X1323(Therefore,)X1646(if)X1710(L1)X1810(were)X1970(to)X2046(split,)X432 5433(the)N543(directory)X826(would)X1029(not)X1144(need)X1303(to)X1382(split.)X1565(In)X1648(reality,)X1872(a)X1926(bucket)X2140(is)X432 5513(allocated)N727(for)X846(the)X969(directory)X1264(at)X1351(the)X1474(time)X1637(of)X1732(\256le)X1858(creation)X2124(so)X432 5593(although)N707(the)X818(directory)X1100(splits)X1274(logically,)X1566(physical)X1828(splits)X2002(do)X2096(not)X432 5673(occur)N610(until)X760(the)X866(\256le)X976(becomes)X1246(quite)X1408(large.)X0 f8 s2994 538 -0.4219(directory)AN3374(=)X3450 -0.3971(double\(directory\);)AX2706 626(})N2706 714 -0.3958(splitbucket\(bucket,)AN3466(newbl\))X2706 802(...)N2418 890(})N2 f10 s3169 1255(hsearch)N1 f2590 1387(Since)N2 f2807(hsearch)X1 f3100(does)X3286(not)X3427(have)X3617(to)X3717(translate)X4027(hash)X2418 1475(values)N2659(into)X2819(disk)X2988(addresses,)X3352(it)X3432(can)X3579(use)X3721(much)X3934(simpler)X2418 1563(algorithms)N2808(than)X2994(those)X3211(de\256ned)X3495(above.)X3775(System)X4058(V's)X2 f
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -