Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / RunningOnNetBSD.adoc
1 RunningOnNetBSD
2 ===============
3
4 MLton runs fine on http://www.netbsd.org/[NetBSD].
5
6 == Installing the correct packages for NetBSD ==
7
8 The NetBSD system installs 3rd party packages by a mechanism known as
9 pkgsrc. This is a tree of Makefiles which when invoked downloads the
10 source code, builds a package and installs it on the system. In order
11 to run MLton on NetBSD, you will have to install several packages for
12 it to work:
13
14 * `shells/bash`
15
16 * `devel/gmp`
17
18 * `devel/gmake`
19
20 In order to get graphical call-graphs of profiling information, you
21 will need the additional package
22
23 * `graphics/graphviz`
24
25 To build the documentation for MLton, you will need the addtional
26 package
27
28 * `textproc/asciidoc`.
29
30 == Tips for compiling and using MLton on NetBSD ==
31
32 MLton can be a memory-hog on computers with little memory. While
33 640Mb of RAM ought to be enough to self-compile MLton one might want
34 to do some tuning to the NetBSD VM subsystem in order to succeed. The
35 notes presented here is what <:JesperLouisAndersen:> uses for
36 compiling MLton on his laptop.
37
38 === The NetBSD VM subsystem ===
39
40 NetBSD uses a VM subsystem named
41 http://www.ccrc.wustl.edu/pub/chuck/tech/uvm/[UVM].
42 http://www.selonen.org/arto/netbsd/vm_tune.html[Tuning the VM system]
43 can be done via the `sysctl(8)`-interface with the "VM" MIB set.
44
45 === Tuning the NetBSD VM subsystem for MLton ===
46
47 MLton uses a lot of anonymous pages when it is running. Thus, we will
48 need to tune up the default of 80 for anonymous pages. Setting
49
50 ----
51 sysctl -w vm.anonmax=95
52 sysctl -w vm.anonmin=50
53 sysctl -w vm.filemin=2
54 sysctl -w vm.execmin=2
55 sysctl -w vm.filemax=4
56 sysctl -w vm.execmax=4
57 ----
58
59 makes it less likely for the VM system to swap out anonymous pages.
60 For a full explanation of the above flags, see the documentation.
61
62 The result is that my laptop goes from a MLton compile where it swaps
63 a lot to a MLton compile with no swapping.