lkml.org 
[lkml]   [1999]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: [linux-usb] Re: USB device allocation
On Fri, 8 Oct 1999, Dan Hollis wrote:

> On Fri, 8 Oct 1999, Khimenko Victor wrote:
> > RJ> The Unix-like kernel knows only major/minor device numbers, not names.
> > Which POSIX standard says how unix-like kernel acts inside ???
>
> I'm beginning to wonder why we're still fumbling around with the
> major/minor concept. Is there any compelling reason for it other than
> "thats the way we've always done it since 1970's, and 640k is enough ram
> for anyone"?
>

Because CPUs are much more efficient at handling numbers than strings.
What 'ls' (readdir) or whatever, does is convert a bunch on numbers to
human-readable form. Internally, files are just numbers (inodes). In
fact, a VFS (virtual file-system) is just a linked-list of inodes.
Periodically, if the linked-list starts to use too much memory, it's
written to physical media and the linked-list is pruned. This is what
Unix file-systems, including ext2, are all about. Some file-systems,
(FAT comes to mind), are not designed in this way. Therefore, to
be compatible, they are partially emulated in the Unix environment.

The human-readable format of a file or a device has no real place
within any operating system. It adds overhead and bulk. It is only
when a human needs such a translation that the translation should
be done.


To give a simple example, given:

LargeFileNameDirectory/LFN-Subdirectory/MyFile.txt

... requires 3 directory lookups to obtain a number. After which,
the file is accessed as a number. It is read/written/extended/truncated,
/seeked, etc, without ever having to parse strings again.

The same is true for 'special files'. These require a lookup first
to associate a major/minor number (instead of an inode). Then the
human readable name string is never accessed again. To do it any other
way would be to return to the days before even CP/M.

Historical buffs may remember that the file-system on the famous
"green-machine" (MDS-200), circa 1967, consisted of 'directory' entries
that contained only numbers. A directory program translated these numbers
into strings in a "container file". (No M$ didn't invent the container
file). Even then, it was understood that strings didn't belong within
an operating system.


So, we are not "fumbling around" with the major/minor concept. It
is an excellent, efficient way of handling devices. However, soon
it will have to be extended because we need more numbers.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:2.120 / U:2.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site