unix file structure (or lack of same)

David Dick drd at siia.mv.com
Thu Nov 8 03:06:11 AEST 1990


In <125379 at linus.mitre.org> duncant at mbunix.mitre.org (Thomson) writes:

>I'm curious about something:

>I understand that, on unix, the file system is designed so that a file always
>looks like a sequence of bytes, with no record structure at all.

>Is this correct?

Yes.

>If so, how does one implement an efficient database manager on unix in
>a standard, portable, way?  To be efficient, a database manager needs to
>have random access into files on a record-oriented basis.

Why does a database manager need record-level access?  Is the calculation
of the address of a record going to be more efficient in supervisor
mode than in user mode?  Doesn't a database manager want to decide
exactly where data will be located and how it will be accessed?
If the OS provides record-level access *it* will be deciding these 
things.

>that fseek() wouldn't do the job.  (Am I wrong here?)  If unix doesn'`t
>provide a record-oriented view of files, then any database implementation 
>would have to go below unix, and access the mass storage devices directly.

>Is this right?

I don't think this is right.  Lack of record-level access does
not imply the necessity for direct access.  Direct access should
be used anyway, for efficiency.  Besides, UNIX *does* allow access to
raw disk, which can be done in a portable way.  That's what the
feature is for.

>I know there are database managers for unix, so there must be ways to
>do it....

The real reason to use "raw" disk is to avoid the logical-to-physical
mapping that UNIX filesystem code does in order to provide the
array-of-bytes model for a file.  That mapping provides some overhead
that can be avoided by using the raw disk.

I don't think a good DBMS implementation should depend on 
an OS record access implementation; it should access a disk 
as directly as it can, so whether the OS provides record-level
access is irrelevant, IMHO.

David Dick
Software Innovations, Inc. [the Software Moving Company (sm)]



More information about the Comp.unix.questions mailing list