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