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