On Sun, 27 Jul 2003, Bob Shannon wrote:
> >The file data is then stored on consecutive sectors, with the last one or
> >two words (depending on word size implemented) pointing to the next sector
> >of the file. Zero values means "end of file".
> >
>
> If you have a pointer to form a linked list, why use consecutive sectors?
I didn't mean that. The sectors can be in any order on any part of the
disk.
> >There also needs to be a map somewhere specifying which sectors are
> >free/used.
>
> Now things are getting complicated! This one component adds a major
> design decision I'd rather
> aviod, how to allocate unused sectors (linear versus first-fit).
That's not complicated at all. You just named two of several choices:
linear or first-fit. Linear is the simplest. Just start at the beginning
of the map and find the first free sector and use it, then repeat. When
the disk is new, there will be lots of large blocks of open space. As the
disk gets used over time, with files enlarged, shrunk, deleted and added,
files will be all over the place. You then write a utility to
re-organize the disk for better performance.
First-fit only adds a little bit of logic to the code to allocate space.
An easy algorithm would be to find the largest block of contiguous space
in the map to fit the file you are saving. If none exists, use the
largest contiguous space to store the first part of the file, then repeat
until the file is saved. This is not a lot of programming.
> >Anything simpler would involve having files take up static areas of the
> >disk, perhaps defined by track boundries, with a fixed number of directory
> >entries (as defined by the total number of file areas) and a limited file
> >size (as defined by the size of each file area).
> >
> This latter approach is more like what I'm thinking of.
Boring.
> The trick then becomes how to efficiently 'squeeze' the disk drive to
> recover space from deleted files?
This is your trade off. You can spend the programming time doing a more
proper filesystem ;)
--
Sellam Ismail Vintage Computer Festival
------------------------------------------------------------------------------
International Man of Intrigue and Danger http://www.vintage.org
* Old computing resources for business and academia at www.VintageTech.com *
Received on Sun Jul 27 2003 - 17:55:00 BST