~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to db/docs/ref/env/region.html

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--$Id: region.so,v 10.25 2001/03/01 15:58:04 bostic Exp $-->
 
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
 
3
<!--All rights reserved.-->
 
4
<html>
 
5
<head>
 
6
<title>Berkeley DB Reference Guide: Shared memory regions</title>
 
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
 
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
 
9
</head>
 
10
<body bgcolor=white>
 
11
<table width="100%"><tr valign=top>
 
12
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Environment</dl></h3></td>
 
13
<td align=right><a href="../../ref/env/security.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/env/remote.html"><img src="../../images/next.gif" alt="Next"></a>
 
14
</td></tr></table>
 
15
<p>
 
16
<h1 align=center>Shared memory regions</h1>
 
17
<p>Each of the Berkeley DB subsystems within an environment is described by one or
 
18
more regions.  The regions contain all of the per-process and per-thread
 
19
shared information, including mutexes, that comprise a Berkeley DB environment.
 
20
These regions are created in one of three areas, depending on the flags
 
21
specified to the <a href="../../api_c/env_open.html">DB_ENV-&gt;open</a> function:
 
22
<p><ol>
 
23
<p><li>If the <a href="../../api_c/env_open.html#DB_PRIVATE">DB_PRIVATE</a> flag is specified to <a href="../../api_c/env_open.html">DB_ENV-&gt;open</a>,
 
24
regions are created in per-process heap memory; that is, memory returned
 
25
by <b>malloc</b>(3).  In this case, the Berkeley DB environment may only
 
26
be accessed by a single process, although that process may be
 
27
multithreaded.
 
28
<p><li>If the <a href="../../api_c/env_open.html#DB_SYSTEM_MEM">DB_SYSTEM_MEM</a> flag is specified to <a href="../../api_c/env_open.html">DB_ENV-&gt;open</a>,
 
29
regions are created in system memory.  When regions are created in system
 
30
memory, the Berkeley DB environment may be accessed by both multiple processes
 
31
and multiple threads within processes.
 
32
<p>The system memory used by Berkeley DB is potentially useful past the lifetime
 
33
of any particular process.  Therefore, additional cleanup may be
 
34
necessary after an application fails because there may be no way for
 
35
Berkeley DB to ensure that system resources backing the shared memory regions
 
36
are returned to the system.
 
37
<p>The system memory that is used is architecture-dependent.  For example,
 
38
on systems supporting X/Open-style shared memory interfaces, such as
 
39
UNIX systems, the <b>shmget</b>(2) and related System V IPC
 
40
interfaces are used. Additionally, VxWorks systems use system memory.
 
41
In these cases, an initial segment ID must be specified by the
 
42
application to ensure that applications do not overwrite each other's
 
43
database environments, so that the number of segments created does not
 
44
grow without bounds.  See the <a href="../../api_c/env_set_shm_key.html">DB_ENV-&gt;set_shm_key</a> function for more
 
45
information.
 
46
<p><li>If no memory-related flags are specified to <a href="../../api_c/env_open.html">DB_ENV-&gt;open</a>, memory
 
47
backed by the filesystem is used to store the regions.  On UNIX systems,
 
48
the Berkeley DB library will use the POSIX mmap interface.  If mmap is not
 
49
available, the UNIX shmget interfaces will be used, assuming they are
 
50
available.
 
51
</ol>
 
52
<p>Any files created in the filesystem to back the regions are created in
 
53
the environment home directory specified to the <a href="../../api_c/env_open.html">DB_ENV-&gt;open</a> call.
 
54
These files are named __db.### (for example, __db.001, __db.002 and
 
55
so on).  When region files are backed by the filesystem, one file per
 
56
region is created.  When region files are backed by system memory, a
 
57
single file will still be created because there must be a well-known
 
58
name in the filesystem so that multiple processes can locate the system
 
59
shared memory that is being used by the environment.
 
60
<p>Statistics about the shared memory regions in the environment can be
 
61
displayed using the <b>-e</b> option to the <a href="../../utility/db_stat.html">db_stat</a> utility.
 
62
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/env/security.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/env/remote.html"><img src="../../images/next.gif" alt="Next"></a>
 
63
</td></tr></table>
 
64
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
 
65
</body>
 
66
</html>