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