[comp.sources.d] Problem with Spacewar under Sys V, dbm.h

rsalz@bbn.com (Rich Salz) (06/11/88)

Okay, fact time.

>Of course it isn't present!  dbm is a Berkeley product..

Totally wrong.  The DBM library was present in Version 7; for some reason
ATT dropped it; nobody seems to know why.  UCB kept it, and improved it to
handle multiple open files, etc.

Now let's go back in time...

A month or two ago someone (zeff@b-tech.uucp?) posted a DBM-like package
to use with News 2.11; from the quick glance I gave it, it did not seem
general enough to be a total DBM replacement.  This could be a totally
unfair assessment.

Many months ago Ken Arnold in \fIUnix Review\fP magazine said that the DBM
package was in the public domain, and some copies appeared on the net.  He
was wrong, articles were cancelled, and the next month there was a
retraction.

Rumor has it that a combination of Chris Torek and James Gosling wrote and
modified a replacement DBM package that Gosling used for the documentation
subsystem that is in the Emacs he wrote while at CMU.  Unipress has a
product based on this "Gosmacs."  I'd love to hear the facts of the
situation.

The key to the DBM package is the clever hasing and block splitting scheme
it uses in maintaining its index files.  Most code I have seen uses this
technique -- if not the exact code; I never compared it against Version 7
sources to know for sure.

Several years ago someone in the UCLA Locus project posted a summary of
how the DBM package does its work.  I sent that description to the GNU
folks.  I would not be surprised if there will eventually be a GNU DBM
package.

Hope all this helps.
	/rich $alz
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.

chris@mimsy.UUCP (Chris Torek) (06/14/88)

In article <937@fig.bbn.com> rsalz@bbn.com (Rich Salz) writes:
>Okay, fact time.

... or is it ... fact-OID?? :-)

>... The DBM library was present in Version 7; for some reason
>ATT dropped it; nobody seems to know why.  UCB kept it, and improved it to
>handle multiple open files, etc.

It may have been one of those things added after the V6/PWB/USG
line split away from the V6/V7/32V line.

>Rumor has it that a combination of Chris Torek and James Gosling wrote and
>modified a replacement DBM package that Gosling used for the documentation
>subsystem that is in the Emacs he wrote while at CMU.  Unipress has a
>product based on this "Gosmacs."  I'd love to hear the facts of the
>situation.

That is some rumour!  jag (that is `James A Gosling': his login id)
took the V7 dbm and modified it in three ways:  First, to support more
than one database; second, to store just one `long' (well, actually
two, offset+size) under each key (as part of the key itself); and
third, to use a third file to store the actual data (now arbitrarily
long, since the `datum' for a given key no longer had to fit in a dbm
block).

Some time after reading jag's version and making two `ndbm's (similar
to the 4.3BSD version, but we were running 4.2BSD/BRL at the time) I
came up with a method of making individual database items serve as both
key and datum as appropriate; I wrote this `multi-keyed dbm' without
looking at the V7 dbm code again, except for the hash function which I
stole outright (as, I believe, did jag).  (By then I had it practically
memorised anyway, so who knows whether that means anything.)  At any
rate, I posted mine, and had it available for anonymous FTP, but after
some footwork by John Gilmore I removed it from general access, as
AT&T's reply as to whether it was free of their stuff was something
like `maybe, but if we decide we care we might sue anyway'.

(Not that dbm is at all suited to a general purpose database.  It
does not even have any locking...!)

I am not sure that I ever did anything to jag's Emacs ndbm code, aside
from possible portability changes (making Emacs run on a Pyramid
exposed numerous Vaxisms).

>The key to the DBM package is the clever hashing and block splitting scheme
>it uses in maintaining its index files.

Well, the hashing scheme anyway, and what goes in the `access' routine
(where the mask, and from that, the block number, is computed).  The
split scheme follows directly from this.  (See my recent followup in
comp.unix.questions.)  The iteration code (which I did not describe)
also follows, but only in a devious way (you run down the left side of
the node tree, then do a depth first traversal using knowledge as to
how the masks work).

>Several years ago someone in the UCLA Locus project posted a summary of
>how the DBM package does its work.

I never saw that one, but I think my last followup was my third
description of the hashing scheme.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

zeeff@b-tech.UUCP (Jon Zeeff) (06/15/88)

There seems to be two copies of dbm in the X11 sources.  One from IBM and
clearly marked

Copyright IBM - you can use, copy, modify and distribute this software ...
for any purpose provided that the above copyright notice ...

the other from HP with no notice.  They appear to be very similar.  I'll
post if there is interest.

--Jon
-- 
Jon Zeeff           		Branch Technology,
uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu