Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!ira.uka.de!smurf!urlichs From: urlichs@smurf.ira.uka.de Newsgroups: comp.sys.mac.programmer Subject: Re: FSWrite moving memory? (was Re: Think C 4.0 questions) Message-ID: <1540@smurf.ira.uka.de> Date: 15 Feb 90 10:21:17 GMT References: <10193@hoptoad.uucp> <2032@cbnewsk.ATT.COM> <1990Feb13.173605.7633@intercon.com> Organization: University of Karlsruhe, FRG Lines: 57 In comp.sys.mac.programmer, article <1990Feb13.173605.7633@intercon.com>, amanda@mermaid.intercon.com (Amanda Walker) writes: < < The actual file operations themselves may [ move memory ] < (although I don't know, offhand, never having dug into the file system < code myself), but they are not done at interrupt time. < Yes they are. Consider the following fragments from Program A: REPEAT SCSIselect() SCSIget() ... SCSIcomplete(); UNTIL Picture_all_here; (* common loop when talking to scanners *) Consider the following fragments from Program B: ATPGetRequest(async,completion_routine); completion_routine: PBread(async); Both are perfectly legal, but if Program A and Program B run under MultiFinde at the same time, and Program B gets an ATP request packet, things start to hang because (a) Program A's loop, which does not call GetNextEvent or anything, is interrupted, (b) neither the hard disk's SCSI driver nor the file system test if the SCSI bus is free, (c) file system requests do get processed at interrupt time. The above happened to me. The workaround seemed to be completion_routine: IF SCSIBusy() AND (FileSystemQueue Empty) THEN put_in_queue_and_try_again_later ELSE PBread(); The above code, unfortunately, can lead to race conditions (when testing, SCSI is free but when HFS gets around to accessing the disk, the bus is not). I don't think there's any fix for this other than the new SCSI manager from System 7.0... < The file system doesn't do "real" :-) asynchronous I/O, but it does let you < queue up operations asynchronously. < Yes it does; the SCSI manager does not. (You can do "real" async IO with your regular disk drives.) Some people, of course, would define "real async" as "requiring DMA". Are there any DMA-SCSI NuBus boards out yet? Do they work with A/UX? Will they work with Sys 7.0? (Its SCSI manager should make it fairly easy to hook such a board into the OS, without resorting to trap patching or disabling the built-in SCSI port. That's a good thing, because I already have 8 SCSI devices including the Mac, and need to connect two more. :-( -- Matthias Urlichs