Subject: Re: The VM System
To: None <tech-kern@NetBSD.ORG>
From: Martin Cracauer <cracauer@wavehh.hanse.de>
List: tech-kern
Date: 11/22/1995 15:51:23
Some problems has been mentioned, let me add that I find it
really unfortunate that NetBSD has a VM system that makes mmap
unusable over NFS, but still has tools that use mmap (like vi), while
others (cp) has been fixed. Imagine what happens when you read bogus
data into vi and save it before you recognize the problem. Of course
fixing the tools is not really fun when you think a fixed VM system
will come RSN.
Another thing not mentioned is paging performance.
I have a simple-minded benchmark that tests performance under heavy
memory load (the code is appended). It iterates over an array that is
a bit larger than main memory and touches every page. FreeBSD-2.0.5 is
about 7 times faster than NetBSD-{summer95-today}, both on the time
required for touching these pages and on executing other programs
while this benchmark is running. This is the same machine, same swap
disk and partition (P90-triton/ncr/barracouda, 32MB RAM, 256 MB
swap). For the potential user, this is the last region where NetBSD is
really slower than the alternatives.
I've heard several times that the core team doesn't "like" John
Dyson's work for FreeBSD, without specific information. While FreeBSD
has many problems for my work, I had never had any problem with the
VM system (with the possible exception that FreeBSD has more problems
with broken hardware than NetBSD). Last I read the code, there were
many comments indicating that something else than "The Right Thing"
(tm) has been done, but so far I count that as a hint that John Dyson
is a careful coder, not as an indication that the code is bad.
Greetings
Martin
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@wavehh.hanse.de>
Tel.: +49 40 / 522 18 29
Fax.: +49 40 / 522 85 36
/* Set CHUNKS to about 10% more than you machine has megabytes of
memory */
/* This program takes the number of iterations as the first parameter.
If not given, an endless loop is performed */
/* Under most circumstances this program shows the problem of lost
swap pages when starting childs, too. Start bigger childs (this
program, for example :-) to see more */
#include <stdio.h>
#include <stdlib.h>
#ifndef CHUNKSIZE
#define CHUNKSIZE 1024*1024
#endif
#ifndef CHUNKS
#define CHUNKS 70
#endif
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
unsigned char *arr[ CHUNKS ];
void one_turn()
{
int i,j;
char foo;
/* Touch every page */
for (i=0;i<CHUNKS;i++)
for (j=0;j<CHUNKSIZE;j+=PAGESIZE) {
foo += ( arr[i][j] = foo); /* This will maybe overflow :-) */
}
/* Start some random childs */
system("echo foo bar | awk '{print $2}' ; pstat -s");
}
main(int argc, char *argv[])
{
int i,n;
for ( i=0 ; i<CHUNKS ; i++) {
if (! (arr[i] = malloc(CHUNKSIZE))) {
perror("Malloc");
exit(1);
}
}
if (argc == 1) {
while (1==1) {
one_turn();
}
}
if (argc == 2) {
n=atoi(argv[1]);
for (i=0 ; i<n ; i++) {
one_turn();
}
}
exit (0);
}