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