Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: async write to disk (MPW C) Message-ID: <48623@apple.Apple.COM> Date: 29 Jan 91 21:34:07 GMT References: <1016@ra.MsState.Edu> Distribution: na Organization: Apple Computer Inc., Cupertino, CA Lines: 36 In article <1016@ra.MsState.Edu> krn1@ra.msstate.edu (Ken Newton) writes: >I am working on a real-time application to run on a Mac fx that >requires very fast data collection to disk. The program is in MPW C >and I use the following calls to try to speed up the write and to >allow the data collection to proceed while the disk is writing. > ioerr = PBAllocContig( myPB, false); /* allocates enough contig space */ > >in loop: > collect a block of data (13K bytes) > wait for ioResult == 0 from last write > PBWrite(myPB, true); /* async true -- DOES NOT SEEM to work */ >end loop > >The write is taking about 50 msec and returning with ioResult already 0. I.e. >the call does not get done in async fashion. For this to work for our >application, the call needs to return in less than 1 msec and (probably) has >to use the DMA capabilities of the fx. > >Any suggestions? You're operating from a misconception. The SCSI chip in the IIfx does indeed provide DMA support, but the SCSI Manager doesn't use the feature. Therefore the SCSI Manager itself is still synchronous, so the data collection and writes to disk are happening in a serial fashion, not concurrently. The other way to do this is if your data acquisition hardware can generate an interrupt, use that to collect data in the background, setting a buffer full flag to alert the foreground part (write to disk) that another buffer is ready. steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Steve Christensen | Apple Computer, Inc. | Disclaimer: | 20525 Mariani Ave, MS-81CS | the above may be stevec@apple.com | Cupertino, CA 95014 | a lie...or not.