ptg10805159
20
ADatabase Library
20.1 Introduction
During the early 1980s, the UNIX System was considered a hostile environment for
running multiuser database systems. (See Stonebraker[ 1981 ]and Weinberger[ 1982 ].)
Earlier systems, such as Version 7, did indeed present large obstacles, since they did not
provide any form of IPC (other than half-duplex pipes) and did not provide any form of
byte-range locking. Many of these deficiencies wereremedied, however.Bythe late
1980s, the UNIX System had evolved to provide a suitable environment for running
reliable, multiuser database systems. Since then, numerous commercial firms have
offered these types of database systems.
In this chapter, we develop a simple, multiuser database library of C functions that
any program can call to fetch and storerecords in a database. (Such a database is often
called akey–value store.) This library of C functions is usually only one part of a
complete database system. We donot develop the other pieces, such as a query
language, leaving these items to the many textbooks on database systems. Our interest
is the parts of the UNIX System interface required by a database library,and how they
relate to the topics we’ve already covered (such as record—byte-range — locking, in
Section 14.3).
20.2 History
One popular library of database functions in the UNIX System is thedbm(3) library.
This library was developed by Ken Thompson and uses a dynamic hashing scheme. It
was originally provided with Version 7, appears in all BSD releases, and was also
743