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