4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>RunningOnNetBSD</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
26 <h1>RunningOnNetBSD</h1>
30 <div class="sectionbody">
31 <div class="paragraph"><p>MLton runs fine on <a href="http://www.netbsd.org/">NetBSD</a>.</p></div>
35 <h2 id="_installing_the_correct_packages_for_netbsd">Installing the correct packages for NetBSD</h2>
36 <div class="sectionbody">
37 <div class="paragraph"><p>The NetBSD system installs 3rd party packages by a mechanism known as
38 pkgsrc. This is a tree of Makefiles which when invoked downloads the
39 source code, builds a package and installs it on the system. In order
40 to run MLton on NetBSD, you will have to install several packages for
42 <div class="ulist"><ul>
45 <span class="monospaced">shells/bash</span>
50 <span class="monospaced">devel/gmp</span>
55 <span class="monospaced">devel/gmake</span>
59 <div class="paragraph"><p>In order to get graphical call-graphs of profiling information, you
60 will need the additional package</p></div>
61 <div class="ulist"><ul>
64 <span class="monospaced">graphics/graphviz</span>
68 <div class="paragraph"><p>To build the documentation for MLton, you will need the addtional
70 <div class="ulist"><ul>
73 <span class="monospaced">textproc/asciidoc</span>.
80 <h2 id="_tips_for_compiling_and_using_mlton_on_netbsd">Tips for compiling and using MLton on NetBSD</h2>
81 <div class="sectionbody">
82 <div class="paragraph"><p>MLton can be a memory-hog on computers with little memory. While
83 640Mb of RAM ought to be enough to self-compile MLton one might want
84 to do some tuning to the NetBSD VM subsystem in order to succeed. The
85 notes presented here is what <a href="JesperLouisAndersen">JesperLouisAndersen</a> uses for
86 compiling MLton on his laptop.</p></div>
88 <h3 id="_the_netbsd_vm_subsystem">The NetBSD VM subsystem</h3>
89 <div class="paragraph"><p>NetBSD uses a VM subsystem named
90 <a href="http://www.ccrc.wustl.edu/pub/chuck/tech/uvm/">UVM</a>.
91 <a href="http://www.selonen.org/arto/netbsd/vm_tune.html">Tuning the VM system</a>
92 can be done via the <span class="monospaced">sysctl(8)</span>-interface with the "VM" MIB set.</p></div>
95 <h3 id="_tuning_the_netbsd_vm_subsystem_for_mlton">Tuning the NetBSD VM subsystem for MLton</h3>
96 <div class="paragraph"><p>MLton uses a lot of anonymous pages when it is running. Thus, we will
97 need to tune up the default of 80 for anonymous pages. Setting</p></div>
98 <div class="listingblock">
99 <div class="content monospaced">
100 <pre>sysctl -w vm.anonmax=95
101 sysctl -w vm.anonmin=50
102 sysctl -w vm.filemin=2
103 sysctl -w vm.execmin=2
104 sysctl -w vm.filemax=4
105 sysctl -w vm.execmax=4</pre>
107 <div class="paragraph"><p>makes it less likely for the VM system to swap out anonymous pages.
108 For a full explanation of the above flags, see the documentation.</p></div>
109 <div class="paragraph"><p>The result is that my laptop goes from a MLton compile where it swaps
110 a lot to a MLton compile with no swapping.</p></div>
115 <div id="footnotes"><hr></div>
117 <div id="footer-text">
119 <div id="footer-badges">