Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!udel!mmdf
From: Leisner.Henr@xerox.com (Marty)
Newsgroups: comp.os.minix
Subject: an interesting glitch  + minix benchmarks (long)
Message-ID: <760@louie.udel.EDU>
Date: Tue, 1-Dec-87 09:34:46 EST
Article-I.D.: louie.760
Posted: Tue Dec  1 09:34:46 1987
Date-Received: Fri, 4-Dec-87 06:29:05 EST
Sender: mmdf@udel.EDU
Lines: 134

I'm now running Minix on my PC-AT in protected mode (all descriptors in GDT, 
hardware task-switching installed, all interrupts and kernel have their own
TSS).
If you want a summary of what I'm doing, drop me a line.  If there is sufficient
interest in what I'm doing, I'll post to the net.  I'll be ready to post a
complete summary later this week.  I'm using Aztec C.

I wrote the following benchmarks quickly to have a measure of system
performance:

Forks:
/* File: forks.c - created by Marty Leisner */
/* leisner.Henr         1-Dec-87  7:37:41 */

/* Copyright (C) 1987 by Martin Leisner. All rights reserved. */

#include 

#define NUM_TIMES	1000
main()
{
	register int i;
	int k;
	for(i = 0; i < NUM_TIMES; i++) 
		switch(fork()) {
			case 0:
				exit();
				break;
			case -1:
				printf("fork broke\n");
				exit();
			default:
				wait(&k);
				break;
		}
	
	putchar(7);
}

	
	
	
Pipes:
/* File: pipes.c - created by Marty Leisner */
/* leisner.Henr         1-Dec-87  8:55:04 */

/* Copyright (C) 1987 by Martin Leisner. All rights reserved. */

#define BLOCK_SIZE 	1000
#define NUM_BLOCKS	1000
char buffer[BLOCK_SIZE];

main()
{
	int pipefd[2];
	register int i;
	pipe(&pipefd);
	
	
	
	switch(fork()) {
		case 0:
			/* child code */
			for(i = 0; i < NUM_BLOCKS; i++)
				if(read(pipefd[0], &buffer, BLOCK_SIZE) != BLOCK_SIZE)
					break;
				;
			printf("child done, i = %d\n", i);
			exit();
			break;
		case -1:
			perror("fork broke");
			exit();
		default:
			/* parent code */
			for(i = 0; i < NUM_BLOCKS; i++)
				write(pipefd[1], &buffer, BLOCK_SIZE);
				
			puts("parent done");
			wait((char *) 0);
			break;
	}
}

Running 
#time forks

and

#time pipes

seems to work fine.

Running
#time forks &
#time pipes &

causes continuous hard disk activity for no apparent reason which I easily see
(unless for some reason the fs is putting the pipe on disk).

time reports half the system time for pipes when run the disk is always getting
hit.

By the way on a 8Mhz PC AT with my heavily hacked OS;
#time forks (with 1k stack)
real	25.0
user	1.6
sys	18.4
#time pipes	(with 40K data)
real	42.0
user	1.6
sys	35.5
#time pipes
real	17.0
user	 1.0
sys	14.0

I'd appreciated hearing from someone who has a distribution kernel running.  I
can't get a distribution kernel to run on a hard disk and I don't want to play
floppy games.

Essentially this measure out to 18.4 msec/fork with 1k data, 35+ msedc/fork with
40K data.

I'm knocking about 80k/sec down the pipe.

A 4.2 BSD Vax 11/780 knows about 120k/sec down a pipe with the same program.
	
marty
ARPA:	leisner.henr@xerox.com
GV:  leisner.henr
NS:  martin leisner:henr801c:xerox