Page 444 - DCAP103_Principle of operating system
P. 444

Unit 14: Case Study of Linux Operating System



            the file system is implemented. Some of these ideas derive from MULTICS, and many of them   Notes
            have been copied by MSDOS, Windows, and other systems, but others are unique to UNIX-
            based systems. With minimal mechanism and a very  limited number  of system calls, Linux
            nevertheless provides a powerful and elegant file system.

            14.6.1 Fundamental Concepts of Linux File System
            The initial Linux file system was the MINIX 1 file system. However, due to the fact that it
            limited file names to 14 characters (in order to be compatible with UNIX Version 7) and
            its maximum file size was 64 MB (which was overkill on the 10 MB hard disks of its era),
            there was interest in better file systems almost from the beginning of the Linux development,
            which began about 5 years after MINIX 1 was released. The first improvement was the ext
            file system, which allowed file names of 255 characters and files of 2 GB, but it was slower
            than the MINIX 1 file system, so the search continued for a while. Eventually, the ext2 file
            system was invented with long file names, long files, and better performance, and that has
            become the main file system. However, Linux supports several dozens of file systems using
            the Virtual File System (VFS) layer (described in the next section).
            When Linux is linked, a choice is offered of which file systems should be built into the kernel.
            Other ones can be dynamically loaded as modules during execution, if need be. A Linux file is
            a sequence of 0 or more bytes containing arbitrary information. No distinction is made between
            ASCII files, binary files, or any other kinds of files. The meaning of the bits in a file is entirely
            up to the file’s owner. The system does not care. File names are limited to 255 characters, and
            all  the  ASCII  characters  except  NUL  are  allowed  in  file  names,  so  a  file  name  consisting  of
            three carriage returns is a legal file name (but not an especially convenient one). By convention,
            many programs expect file names to consist of a base name and an extension, separated by a
            dot (which counts as a character). Thus prog.c is typically a C program, prog.f90 is typically a
            FORTRAN 90 program, and prog.o is usually an object file (compiler output). These conventions
            are not enforced by the operating system but some compilers and other programs expect them.
            Extensions may be of any length and files may have multiple extensions, as in prog.java.gz,
            which is probably a gzip compressed Java program.
            Files can be grouped together in directories for convenience. Directories are stored as files, and
            to a large extent can be treated like files. Directories can contain subdirectories, leading to a
            hierarchical file system. The root directory is called / and usually contains several subdirectories.
            The / character is also used to separate directory names, so that the name /usr/ast/x denotes the
            file x located in the directory ast, which itself is in the /usr directory. Some of the major directories
            near the top of the tree are shown in Figure 14.23. There are two ways to specify file names in
            Linux, both to the shell and when opening a file from within a program. The first way is using
            an absolute path, which means telling how to get to the file starting at the root directory. An
            example of an absolute path is /usr/ast/books/mos3/chap-10. This tells the system to look in
            the root directory for a directory called usr, then look there for another directory, ast. In turn,
            this directory contains a directory books.


                    Figure 14.23: Some Important Directories Found in Most Linux Systems


                           Directory         Contents

                           bin               Binary (executable) programs
                           dev               Special files for I/O devices

                           etc               Miscellaneous system files

                           lib               Libraries

                           usr               User directories




                                             LOVELY PROFESSIONAL UNIVERSITY                                   437
   439   440   441   442   443   444   445   446   447   448   449