### Berkeley DB Reference Guide: Architecture |

# Programming model

The Berkeley DB distribution is a database library, where the library is linked into the address space of the code which uses it. The code using Berkeley DB may be an application or it may be a server providing functionality to a number of clients via some form of inter-process or remote-process communication (IPC/RPC).

In the application model, one or more applications link the Berkeley DB library directly into their address spaces. There may be many threads of control in this model, as Berkeley DB supports locking for both multiple processes and for multiple threads within a process. This model provides significantly faster access to the database functionality, but implies trust among all threads of control sharing the database environment as they will have the ability to read, write and potentially corrupt each other's data.

In the client-server model, developers write a database server application that accepts requests via some form of IPC and issues calls to the Berkeley DB interfaces based on those requests. In this model, the database server is the only application linking the Berkeley DB library into its address space. The client-server model trades performance for protection, as it does not require that the applications share a protection domain with the server, but IPC/RPC is slower than a function call. Of course, in addition, this model greatly simplifies the creation of network client-server applications.

Copyright Sleepycat Software