BSD 4_4 release
[unix-history] / usr / share / doc / smm / 02.config / d.t
CommitLineData
ad787160
C
1.\" Copyright (c) 1983, 1993
2.\" The Regents of the University of California. All rights reserved.
5eda3e70 3.\"
ad787160
C
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
3edcb7c8 19.\"
ad787160
C
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)d.t 8.1 (Berkeley) 6/8/93
5eda3e70 33.\"
57349e41 34.\".ds RH "Data Structure Sizing Rules
5eda3e70 35.bp
5eda3e70
KM
36.LG
37.B
38.ce
39APPENDIX D. VAX KERNEL DATA STRUCTURE SIZING RULES
57349e41 40.sp
5eda3e70
KM
41.R
42.NL
43.PP
44Certain system data structures are sized at compile time
45according to the maximum number of simultaneous users expected,
46while others are calculated at boot time based on the
57349e41 47physical resources present, e.g. memory. This appendix lists
5eda3e70
KM
48both sets of rules and also includes some hints on changing
49built-in limitations on certain data structures.
50.SH
51Compile time rules
52.PP
57349e41 53The file \fI/sys/conf\|/param.c\fP contains the definitions of
5eda3e70
KM
54almost all data structures sized at compile time. This file
55is copied into the directory of each configured system to allow
56configuration-dependent rules and values to be maintained.
57349e41
MK
57(Each copy normally depends on the copy in /sys/conf,
58and global modifications cause the file to be recopied unless
59the makefile is modified.)
5eda3e70
KM
60The rules implied by its contents are summarized below (here
61MAXUSERS refers to the value defined in the configuration file
62in the ``maxusers'' rule).
57349e41
MK
63Most limits are computed at compile time and stored in global variables
64for use by other modules; they may generally be patched in the system
65binary image before rebooting to test new values.
5eda3e70
KM
66.IP \fBnproc\fP
67.br
57349e41
MK
68The maximum number of processes which may be running at any time.
69It is referred to in other calculations as NPROC and is defined to be
70.DS
7120 + 8 * MAXUSERS
72.DE
5eda3e70
KM
73.IP \fBntext\fP
74.br
57349e41
MK
75The maximum number of active shared text segments.
76The constant is intended to allow for network servers and common commands
77that remain in the table.
78It is defined as
79.DS
8036 + MAXUSERS.
81.DE
5eda3e70
KM
82.IP \fBninode\fP
83.br
84The maximum number of files in the file system which may be
85active at any time. This includes files in use by users, as
86well as directory files being read or written by the system
57349e41
MK
87and files associated with bound sockets in the UNIX IPC domain.
88It is defined as
89.DS
90(NPROC + 16 + MAXUSERS) + 32
91.DE
5eda3e70
KM
92.IP \fBnfile\fP
93.br
94The number of ``file table'' structures. One file
95table structure is used for each open, unshared, file descriptor.
96Multiple file descriptors may reference a single file table
97entry when they are created through a \fIdup\fP call, or as the
98result of a \fIfork\fP. This is defined to be
99.DS
57349e41 10016 * (NPROC + 16 + MAXUSERS) / 10 + 32
5eda3e70 101.DE
5eda3e70
KM
102.IP \fBncallout\fP
103.br
104The number of ``callout'' structures. One callout
105structure is used per internal system event handled with
106a timeout. Timeouts are used for terminal delays,
107watchdog routines in device drivers, protocol timeout processing, etc.
57349e41
MK
108This is defined as
109.DS
11016 + NPROC
111.DE
5eda3e70
KM
112.IP \fBnclist\fP
113.br
114The number of ``c-list'' structures. C-list structures are
57349e41
MK
115used in terminal I/O, and currently each holds 60 characters.
116Their number is defined as
117.DS
11860 + 12 * MAXUSERS
119.DE
5eda3e70
KM
120.IP \fBnmbclusters\fP
121.br
122The maximum number of pages which may be allocated by the network.
123This is defined as 256 (a quarter megabyte of memory) in /sys/h/mbuf.h.
124In practice, the network rarely uses this much memory. It starts off
57349e41 125by allocating 8 kilobytes of memory, then requesting more as
5eda3e70
KM
126required. This value represents an upper bound.
127.IP \fBnquota\fP
128.br
129The number of ``quota'' structures allocated. Quota structures
130are present only when disc quotas are configured in the system. One
131quota structure is kept per user. This is defined to be
57349e41
MK
132.DS
133(MAXUSERS * 9) / 7 + 3
134.DE
5eda3e70
KM
135.IP \fBndquot\fP
136.br
137The number of ``dquot'' structures allocated. Dquot structures
138are present only when disc quotas are configured in the system.
139One dquot structure is required per user, per active file system quota.
140That is, when a user manipulates a file on a file system on which
141quotas are enabled, the information regarding the user's quotas on
142that file system must be in-core. This information is cached, so
143that not all information must be present in-core all the time.
57349e41
MK
144This is defined as
145.DS
146NINODE + (MAXUSERS * NMOUNT) / 4
147.DE
148where NMOUNT is the maximum number of mountable file systems.
5eda3e70
KM
149.LP
150In addition to the above values, the system page tables (used to
151map virtual memory in the kernel's address space) are sized at
b6426608 152compile time by the SYSPTSIZE definition in the file /sys/vax/vmparam.h.
57349e41
MK
153This is defined to be
154.DS
15520 + MAXUSERS
156.DE
157pages of page tables.
5eda3e70
KM
158Its definition affects
159the size of many data structures allocated at boot time because
160it constrains the amount of virtual memory which may be addressed
161by the running system. This is often the limiting factor
57349e41
MK
162in the size of the buffer cache, in which case a message is printed
163when the system configures at boot time.
5eda3e70
KM
164.SH
165Run-time calculations
166.PP
167The most important data structures sized at run-time are those used in
57349e41
MK
168the buffer cache. Allocation is done by allocating physical memory
169(and system virtual memory) immediately after the system
5eda3e70
KM
170has been started up; look in the file /sys/vax/machdep.c.
171The amount of physical memory which may be allocated to the buffer
172cache is constrained by the size of the system page tables, among
173other things. While the system may calculate
174a large amount of memory to be allocated to the buffer cache,
175if the system page
176table is too small to map this physical
177memory into the virtual address space
178of the system, only as much as can be mapped will be used.
179.PP
180The buffer cache is comprised of a number of ``buffer headers''
181and a pool of pages attached to these headers. Buffer headers
182are divided into two categories: those used for swapping and
57349e41
MK
183paging, and those used for normal file I/O. The system tries
184to allocate 10% of the first two megabytes and 5% of the remaining
185available physical memory for the buffer
5eda3e70
KM
186cache (where \fIavailable\fP does not count that space occupied by
187the system's text and data segments). If this results in fewer
188than 16 pages of memory allocated, then 16 pages are allocated.
189This value is kept in the initialized variable \fIbufpages\fP
190so that it may be patched in the binary image (to allow tuning
57349e41
MK
191without recompiling the system),
192or the default may be overridden with a configuration-file option.
193For example, the option \fBoptions BUFPAGES="3200"\fP
194causes 3200 pages (3.2M bytes) to be used by the buffer cache.
195A sufficient number of file I/O buffer headers are then allocated
196to allow each to hold 2 pages each.
197Each buffer maps 8K bytes.
198If the number of buffer pages is larger than can be mapped
199by the buffer headers, the number of pages is reduced.
200The number of buffer headers allocated
201is stored in the global variable \fInbuf\fP,
202which may be patched before the system is booted.
203The system option \fBoptions NBUF="1000"\fP forces the allocation
204of 1000 buffer headers.
205Half as many swap I/O buffer headers as file I/O buffers
206are allocated,
207but no more than 256.
5eda3e70
KM
208.SH
209System size limitations
210.PP
211As distributed, the sum of the virtual sizes of the core-resident
57349e41
MK
212processes is limited to 256M bytes. The size of the text
213segment of a single process is currently limited to 6M bytes.
214It may be increased to no greater than the data segment size limit
215(see below) by redefining MAXTSIZ.
216This may be done with a configuration file option,
217e.g. \fBoptions MAXTSIZ="(10*1024*1024)"\fP
218to set the limit to 10 million bytes.
219Other per-process limits discussed here may be changed with similar options
220with names given in parentheses.
221Soft, user-changeable limits are set to 512K bytes for stack (DFLSSIZ)
222and 6M bytes for the data segment (DFLDSIZ) by default;
223these may be increased up to the hard limit
224with the \fIsetrlimit\fP\|(2) system call.
225The data and stack segment size hard limits are set by a system configuration
226option to one of 17M, 33M or 64M bytes.
227One of these sizes is chosen based on the definition of MAXDSIZ;
228with no option, the limit is 17M bytes; with an option
229\fBoptions MAXDSIZ="(32*1024*1024)"\fP (or any value between 17M and 33M),
230the limit is increased to 33M bytes, and values larger than 33M
231result in a limit of 64M bytes.
5eda3e70 232You must be careful in doing this that you have adequate paging space.
57349e41
MK
233As normally configured , the system has 16M or 32M bytes per paging area,
234depending on disk size.
5eda3e70
KM
235The best way to get more space is to provide multiple, thereby
236interleaved, paging areas.
57349e41
MK
237Increasing the virtual memory limits results in interleaving of
238swap space in larger sections (from 500K bytes to 1M or 2M bytes).
5eda3e70 239.PP
57349e41
MK
240By default, the virtual memory system allocates enough memory
241for system page tables mapping user page tables
242to allow 256 megabytes of simultaneous active virtual memory.
243That is, the sum of the virtual memory sizes of all (completely- or partially-)
244resident processes can not exceed this limit.
245If the limit is exceeded, some process(es) must be swapped out.
5eda3e70
KM
246To increase the amount of resident virtual space possible,
247you can alter the constant USRPTSIZE (in
248/sys/vax/vmparam.h).
57349e41 249Each page of system page tables allows 8 megabytes of user virtual memory.
5eda3e70
KM
250.PP
251Because the file system block numbers are stored in
252page table \fIpg_blkno\fP
253entries, the maximum size of a file system is limited to
57349e41 2542^24 1024 byte blocks. Thus no file system can be larger than 8 gigabytes.
5eda3e70 255.PP
57349e41
MK
256The number of mountable file systems is set at 20 by the definition
257of NMOUNT in /sys/h/param.h.
258This should be sufficient; if not, the value can be increased up to 255.
259If you have many disks, it makes sense to make some of
5eda3e70 260them single file systems, and the paging areas don't count in this total.
5eda3e70 261.PP
57349e41
MK
262The limit to the number of files that a process may have open simultaneously
263is set to 64.
264This limit is set by the NOFILE definition in /sys/h/param.h.
265It may be increased arbitrarily, with the caveat that the user structure
266expands by 5 bytes for each file, and thus UPAGES (/sys/vax/machparam.h)
267must be increased accordingly.
b6426608 268.PP
57349e41 269The amount of physical memory is currently limited to 64 Mb
b6426608 270by the size of the index fields in the core-map (/sys/h/cmap.h).
57349e41
MK
271The limit may be increased by following instructions in that file
272to enlarge those fields.