THRASH(1) THRASH(1)
thrash - thrash memory to explore paging behavior
thrash [args]
thrash will allocate a region of its virtual memory of a size given by
its arguments, and either randomly or sequentially access that memory in
order to explore the system paging behavior.
The amount of memory to thrash over is specified by a size flag followed
by an integer argument, whose units are determined by the particular size
flag used. The flag may be -m, for megabytes, -p, for pages; or -k for
kilobytes. An additional argument of -s implies sequential thrashing;
the default is random. Another optional argument, -n count, gives the
number of references to make before exiting; it defaults to 10000. An
optional argument -w followed by an integer time tells thrash to sleep
for ``time'' seconds after thrashing, but before exiting.
Once the memory is allocated, thrash prints a message on stdout saying
how much it is using, and then proceeds to thrash over it.
thrash can be used, in conjunction with cvusage and squeeze to determine
the approximate available working memory on a system. To do so, run the
command:
ssusage thrash -m 4
which asks thrash to use about 4 MB of memory. When the command
completes, the resource usage of thrash is printed; the value labeled
majf gives the number of major page faults it took, that is the number of
faults that required a physical read. When run on a machine with a large
amount of physical memory, this value is the number of faults needed to
start the program, which is the minimum number for any run.
Then, as superuser, and in a separate window, run squeeze to lock down
varying amounts of memory, and rerun ``ssusage thrash -m 4". The majorfault
number will remain low at first, but as you squeeze out more and
more memory, it will rise. The amount of available memory reported by
squeeze at point at which thrash begins to page-fault tells you the
combined working set of thrash (~ 4MB), the kernel, and any other
applications you have running.
ssusage(1), squeeze(1)
PPPPaaaaggggeeee 1111 [ Back ]
|