From: dirkst@rama.informatik.rwth-aachen.de (Dirk Steinberg)
Newsgroups: comp.unix.bsd
Subject: Experiences with 386BSD (long)
Keywords: 386BSD
Date: 10 Apr 92 13:49:37 GMT
Organization: RBI - RWTH Aachen

Well, I finally got my boot problem solved. I used the bsd-boot package
that is floating around on the net. I had to do some hacking to get it
to run, especially to work around gas bugs. This also allows 386BSD
to coexist with DOS and Linux on my Harddisk, with one primary partition
still free. Very nice. I will post a binary version of the bootcode
to this group. Now I can boot from Harddisk, but I still cannot boot
from floppy, in case of a crash... 
Well, I have a raw backup of the first 25 cylinders of my harddisk
(master boot, disklabel, bsd-boot, root file system).

One very annoying bug is in the PC console emulation. The screen output
pauses for about half a second after every 2/3 of a screen full of
output. I haven't been able of find out the cause, but I found a comment
in pccons.c:

   /*
    * Compensate for abysmally stupid frame buffer aribitration with macro
    */
   #define	wrtchar(c) { do *crtat = (c); while ((c) != *crtat); \
                crtat++; row++; }

Maybe this has something to do with it? Anyway, the effect is that screen
output tends to be *very* slow overall. Am I the only one with this problem
or is someone else seeing it also?

Does anyone have any clue as to what cpuspeed should be set to (used in
DELAY ()). I have tried values from 1 to 10000, with no apparent difference.

Also, my machine tends to lock up when doing massive amounts of disk I/O.
When I send these processes to background, they hang in diskwait ('D'
state of ps). You cannot kill them and there is no way to get rid of them
short of rebooting.

I found out that the following program locks the machine with all kernels
I could get hold of (0.0new, 0.0newer, some of my own):

null.c:		main () {while (1) ;}

Even when started with "nice null &" the console lock up totally. I don't
know what happens with the kernel, maybe it's still accessible from the
net, but I'm running standalone. The scheduling seems to be non-preemptive!?

I am running 2 harddisks now. All works well, except that I cannot have
a different disklabel on the second disk. That is, I *did* write a label
to /dev/rwd1c, and I can read it from the raw device, but the in-core
copy that the kernel uses to access the second drive seems to be the same
one as for the first disk.

Also, does anyone know which values can be used for tunefs -a reliably?
Or, what is maxphys? I figured that maxphys could be at most 64K, but
reading the raw device with dd produced crashes even with 32K buffer
size. I am now using tunefs -a 7 and it seems to work. On a new, clean
filesystem I get a throughput of up to 960 K/sec for reading large files.
(I have two Quantum LPS 240 AT drives). That seems pretty good to me!

Reading the raw floppy device /dev/rfd0a (3.5 ") gave me wrong data on every
4K boundary (0 on 4096, 8192, ...) when using 18K buffer size. With 9K
it seems to work...

Now to the buffer cache: When I do 'du /usr/src/sys/i386' a couple of times
in a row I notice the there is disk activity each time. I think that should
not be so. There are only a few directory blocks and a few inodes in there,
and they should be kept in the buffer cache. Even when the accessed times of
the directories get updated, those buffers should be write-behind and only
be flushed to disk on the next sync () from update. BTW, I set bufpages
to 1024 in machdep.c, which should give me 4 meg buffer cache (I have 16 MB
ram). Does anyone know what nbuf and nswbuf is good for? I read McKusick's
book on 4.3bsd, which states that each buffer is allocted 8K of virtual
memory, but only mapped with 2K of physical memory at first. I am using
4K/512 byte filesystems and the pagesize of the i386 is 4K, right? So there
seems no way to partially populate buffers with real memory. Then, I wonder,
why is nbuf set to bufpages/2, and nswbuf to nbuf/2?

I found that 'option MFS' is enabled in some of the configuration files
that come with the source. This stands for Memory based File System, i.e.,
you can use any free virtual memory (swap space) as /tmp. This is very fast
and quite useful. Sun calls this 'tmpfs'. Now, the kernel compiles fine
with MFS, but the man page to mount states that it will call /sbin/mount_mfs
when you do an mfs mount. I looked in the net2 sources, but I cannot find
the sources to mount_mfs anywhere. Any pointers appreciated!
Is it still true for the new vm (from mach I suppose) that swap space is
allocated for *all* virtual memory, or can I use the swap space in addition
to any free physical memory that I have (like in Linux)?
Does mmap() work in 386BSD?

Thanks for any help.

Dirk Steinberg
dirkst@messua.informatik.rwth-aachen.de