From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 22-NOV-1990 08:07:59.32
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	The RIGHT version of RAMDRIVER, part 5 of 5

Received:  by crdgw1.ge.com (5.57/GE 1.78)
	 id AA21299; Thu, 22 Nov 90 07:50:43 EST
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Thu, 22 NOV 90 03:19:03 PST
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA24022; Thu, 22 Nov 90 03:00:56 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 21 Nov 90 00:40:31 GMT
From: gkn@ucsd.edu  (Gerard K. Newman)
Organization: San Diego Supercomputer Center
Subject: The RIGHT version of RAMDRIVER, part 5 of 5
Message-Id: <23376@ucsd.Edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
Xroutine (which must execute at driver fork IPL, almost universally IPL$_SYNC
VH)
Xaltogether.  This turns out to be next to impossible, since the FDT routines
Xfor disk devices do lots of processing related to manipulating the file syst
Vem.
XIt's best to let DEC do the code for those, and DEC's FDT routines exit by
Xqueueing the IRP to the driver's start I/O routine.
X
XSo, what you can do in the start I/O routine is to turn around and queue a
Xkernel-mode AST back to the requestor process.  The kernel mode AST will
Xexecute at IPL$_ASTDEL in the context of the issuing process.  This has two
Xadvantages:  one is that we're no longer at IPL$_SYNCH, and the other is tha
Vt
Xwe have process context, and process virtual address space is mapped (which
V is
Xnot true for the start I/O routine, which executes in reduced fork context).
XThus the user's buffer is visible without having to double-map it.
X
XA further performance optimization you can make once your data transfers tak
Ve
Xplace without disabling the scheduler is to allow multiple simultaneous read
Xrequests to occur.  The MOVC3 instruction is interruptable, and processes ca
Vn
Xcompete for the CPU in the "middle" of executing that instruction.  Thus, we
Xcan protect the RAM disk using a MUTEX, which allows multiple read lockers,
Xand a single write locker.  Write requests are still single-threaded (one
Xwriter at a time), and therefore maintains proper data integrity.
X
XAs you've probably guessed by now I've written a replacement for DEC's PDDRI
VVER.
XIt does everything PDDRIVER does except support system booting, which it was
Vn't
Xdesigned to do (that's all DEC's was designed to do).  Mine is supposed to b
Ve
Xa faster disk.  To give you some idea of the results of all of this, I wrote
V a
Xprogram which uses block mode RMS to read and subsequently write 64 block ch
Vunks
Xto a 128 block contiguous file, rewinding when it hits EOF.  I put the file
V it
Xoperates on on three different devices:  an RA81 connected to an HSC-50, a R
VAM
Xdisk controlled by DEC's PDDRIVER, and a RAM disk controlled by my driver.
V  The
Xprogram makes 2000 passes through the loop reading and writing blocks.  Here
Xare the results for a single job mashing on the file:
X
XRA81/HSC50: ELAPSED: 0 00:06:06.84  CPU: 0:00:33.54  BUFIO: 2  DIRIO: 5000
V  FAULTS: 13`032
XPDDRIVER:   ELAPSED: 0 00:08:47.22  CPU: 0:08:10.49  BUFIO: 3  DIRIO: 5002
V  FAULTS: 6`032
XRAMDRIVER:  ELAPSED: 0 00:01:35.64  CPU: 0:01:12.65  BUFIO: 3  DIRIO: 5000
V  FAULTS: 6`032
X
XSince the program uses UPI (user process interlocking), you can start multip
Vle
Xcopies bashing on the same file.  Since this is just a response time test it
Xdoesn't really matter what this does to the file, all that matters is that y
Vou
Xget some idea of the scaling for multiple processes accessing the disk.  I t
Vook
Xthe same file, and started 5 copies of the program running on it.  Here are
V the
Xresults:
X
XRA81/HSC50:
X
X ELAPSED:    0 00:20:37.14  CPU: 0:00:32.75  BUFIO: 2  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:20:40.20  CPU: 0:00:34.49  BUFIO: 2  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:20:40.82  CPU: 0:00:31.80  BUFIO: 2  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:20:42.59  CPU: 0:00:33.30  BUFIO: 2  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:20:39.12  CPU: 0:00:32.14  BUFIO: 2  DIRIO: 5000  FAULTS:
V 13`032
X
XPDDRIVER:
X
X ELAPSED:    0 00:41:39.63  CPU: 0:08:03.59  BUFIO: 3  DIRIO: 5002  FAULTS:
V 13`032
X ELAPSED:    0 00:42:16.22  CPU: 0:08:02.16  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:43:06.47  CPU: 0:08:03.88  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:42:29.57  CPU: 0:08:03.66  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:41:36.60  CPU: 0:08:02.55  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X
XRAMDRIVER:
X
X ELAPSED:    0 00:05:18.13  CPU: 0:01:12.33  BUFIO: 3  DIRIO: 5002  FAULTS:
V 13`032
X ELAPSED:    0 00:06:03.99  CPU: 0:01:11.81  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:06:19.82  CPU: 0:01:12.32  BUFIO: 3  DIRIO: 5002  FAULTS:
V 13`032
X ELAPSED:    0 00:05:28.92  CPU: 0:01:11.66  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X ELAPSED:    0 00:06:06.50  CPU: 0:01:12.75  BUFIO: 3  DIRIO: 5000  FAULTS:
V 13`032
X
X
XNote that in both cases DEC's RAM disk driver is slower than a real disk, an
Vd
Xwhen there are multiple accessors, it's *significantly* slower.  These numbe
Vrs
Xdo not suggest that using PDDRIVER to speed your system up is a win.
X
XI'm not satisfied that RAMDRIVER is 100% safe yet;  I intend to bash it here
Xat SDSC until I'm quite satisfied that it works.  I'll keep y'all posted.
X
Xgkn
X----------------------------------------
XInternet: GKN@SDS.SDSC.EDU
XBitnet:   GKN@SDSC
XSpan:     SDSC::GKN (27.1)
XMFEnet:   GKN@SDS
XUSPS:`009  Gerard K. Newman
X          San Diego Supercomputer Center
X          P.O. Box 85608
X          San Diego, CA 92138-5608
XPhone:    619.534.5076
$ CALL UNPACK OLD-RAMD-BLURB.TXT;2 57271299
$ v=f$verify(v)
$ EXIT
-- 
gkn	Gerard K. Newman		gkn@sds.sdsc.edu	619.534.5076
	San Diego Supercomputer Center	gkn@sdsc.bitnet		619.534.5152 FAX
	PO Box 85608			sdsc::gkn (27.1/span)
	San Diego, CA  92186-9784	ucsd!gkn

