Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!uunet!mcvax!hp4nl!kunivv1!wn2!janhen From: janhen@wn2.sci.kun.nl (Jan Hendrikx) Newsgroups: comp.sys.cbm Subject: Re: SEQ file access speedup Keywords: Interleave, fast SEQ access Message-ID: <338@wn2.sci.kun.nl> Date: 18 Feb 89 20:21:19 GMT References: <89Feb10.182100est.2732@godzilla.eecg.toronto.edu> <89Feb18.010253est.2384@godzilla.eecg.toronto.edu> Organization: University of Nijmegen, The Netherlands. Lines: 53 In article <89Feb18.010253est.2384@godzilla.eecg.toronto.edu>, leblanc@eecg.toronto.edu (Marcel LeBlanc) writes: > I don't remember under what situations the DOS will do read-ahead, but the > point was that since the DOS follows the interleave chain, it won't send the > file any faster than the interleave allows, no matter what sort of interface > you are using. That was not the point that I was trying to make. What you say is of course true. I just wanted to inform the person who thought the DOS does no read-ahead at all. > Since you brought it up, under what situations will the DOS do read-ahead? As far as I remember without my references around, (I don't have a 64 anymore for over two years now), the algorithm is about the following: If a file is opened for sequential reading, an 'active' buffer is allocated, which is filled from the disk. Active means that the next byte that can be requested from the computer, must come from that buffer. Also, an 'inactive' buffer is allocated, if possible. That buffer is filled in from disk asyncronously. When the active buffer is emtied by read requests from the computer, buffers are switched from active to inactive and vv. Of course, if the inactive buffer has not yet finished reading from disk, the computer must wait. There is a routine which takes a buffer number and sets a pointer to that buffer somewhere. It maintais a Least Recently Used stack, based on the requests it gets. Whenever a buffer is needed, but no unused buffer is available, an inactive buffer is found based on the LRU stack. The idea is that the buffer that is not used for the longest time, will not likely be used again soon. So it is 'safe' to use it for something else. The routine that switches buffers knows that inactive buffers may disappear. If they do, it does something reasonable. I am not sure if it just reads the next block into the one buffer that is left, or if it first tries to get a new second buffer. In any case, the buffer that was read-ahead must be re-read from the disk. Relative files have two active buffers: one for a side-sector, and one for actual data. I am not sure if it also reads-ahead. Some other things I would need to look up are whether files open for writing also have an inactive (write-behind) buffer, and whether (trying to) allocate an inactive buffer may cause another inactive buffer to be discarded. As you can see, the operating system in the drive is considerably more complex than that in the computer... > Marcel A. LeBlanc | University of Toronto -- Toronto, Canada > leblanc@eecg.toronto.edu | also: LMS Technologies Ltd, Fredericton, NB, Canada -Olaf Seibert