axf-os161 / man / testbin / bloat.html
bloat.html
Raw
<!--
Copyright (c) 2015
	The President and Fellows of Harvard College.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-->
<html>
<head>
<title>bloat</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>bloat</h2>
<h4 align=center>OS/161 Reference Manual</h4>

<h3>Name</h3>
<p>
bloat - waste memory
</p>

<h3>Synopsis</h3>
<p>
<tt>/testbin/bloat</tt>
[<tt>-a </tt><em>allocs</em>]
[<tt>-b </tt><em>bias</em>]
[<tt>-p </tt><em>touchpages</em>]
</p>

<h3>Description</h3>
<p>
<tt>bloat</tt> allocates all available memory one page at a time until
it runs out.
Unlike other tests that do this, it has been gimmicked up so that it
runs in a fairly reasonable amount of time even when swapping.
</p>

<p>
It runs in cycles; every cycle it allocates <em>allocs</em> pages, one
at a time, by calling <A HREF=../syscall/sbrk.html>sbrk</A> (not
<A HREF=../libc/malloc.html>malloc</A>), then touches <em>touchpages</em>
pages.
It chooses the pages it touches as follows:
</p>
<ul>
<li><p>
1 in 1000 pages are chosen uniformly from the entire allocated space.
</p></li>
<li><p>
The rest are taken from the middle 1% of the space; note that this
range shifts upwards as more pages are allocated.
</p></li>
<li><p>
It rolls <em>bias</em> dice to pick pages from the middle 1%.
The more dice, the tighter the distribution it picks and the
faster it runs.
</p></li>
</ul>
<p>
The default settings are 4 <em>allocs</em>, 8 <em>touchpages</em>
and a <em>bias</em> of 8.
This gives reasonable performance with reasonable amounts of memory on
the solution set.
There are enough things affecting the speed that you may want to
experiment with the settings when testing on your own VM system.
</p>

<h3>Requirements</h3>
<p>
<tt>bloat</tt> uses the following system calls:
<ul>
<li><A HREF=../syscall/sbrk.html>sbrk</A></li>
<li><A HREF=../syscall/write.html>write</A></li>
<li><A HREF=../syscall/_exit.html>_exit</A></li>
</ul>
</p>

<p>
<tt>bloat</tt> should work once you have implemented your VM system
and added the sbrk system call.
It may not run fast by default, but it should always be faster than
<A HREF=sbrktest.html>sbrktest</A> 10 or the notoriously glacial
<A HREF=malloctest.html>malloctest</A> 3.
</p>

</body>
</html>