Operating Systems Chapter 6: File Systems H 6.1 Files 46.2 Directories E 6.3 File system implementation H 6.4 Example file systems Gao Haichang, Software School, Xidian University 3
Operating Systems Gao Haichang , Software School, Xidian University 3 Chapter 6: File Systems 6.1 Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems
Operating Systems Long-term Information Storage Three essential requirements: Must be possible to store a large amount of information 2. Information stored must survive the termination of the process using it 3. Multiple processes must be able to access the information concurrently The usual solution to all these problems is to store information on disks and other external media in units called files Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 4 Long-term Information Storage Three essential requirements: 1. Must be possible to store a large amount of information 2. Information stored must survive the termination of the process using it 3. Multiple processes must be able to access the information concurrently The usual solution to all these problems is to store information on disks and other external media in units called files
Operating Systems C File Naming G The extra rules for naming vary somewhat from system to system. m bruce device. multimedia E 123, urgent! fig 2-1 a longlongagotherewasawarbetweentthebirdsandthebeasts (<255) G Some file systems distinguish between upper and lower ease letters Un), whereas others do not Ms-dos) G Many OS support two-part file names, with the two parts separated by a period, as in prog. c. The part following the period is called the file extension. Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 5 File Naming The extra rules for naming vary somewhat from system to system. bruce, device, multimedia 123, urgent!, fig.2-1 longlongagotherewasawarbetweentthebirdsandthebeasts (<255) Some file systems distinguish between upper and lower ease letters (UNIX), whereas others do not (MS-DOS). Many OS support two-part file names, with the two parts separated by a period, as in prog.c. The part following the period is called the file extension
Operating Systems File Naming Extension Meaning file. bak Backup file file. c c source program file. gif Compuserve Graphical Interchange format image file. hl Help file file.html World Wide Web Hyper Text Markup language document file.jpg Still picture encoded with the JPEG standard file.mp3 Music encoded in mPEG layer 3 audio format file. mpg Movie encoded with the mPeg standard file. o Object file(compiler output, not yet linked file. pdf Portable Document Format file file. ps Postscript file file. tex Input for the tEX formatting program file. txt General text file file.zip Compressed archive Typical file extensions. Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 6 File Naming Typical file extensions
Operating Systems File structure 1 By 1 Record Ant‖Fox‖Pi CatCow‖bog‖doat‖uion‖ow‖Pony‖ Rat Worm Hen‖ Ibis‖Lamb (a) byte sequence (UNIX and Windows (b)record sequence (80-character punched card) (c)tree(commercial data processing large mainframe computers) G Three kinds of files Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 7 File Structure (a) byte sequence (UNIX and Windows) (b) record sequence (80-character punched card) (c) tree (commercial data processing large mainframe computers) Three kinds of files
Operating Systems File Types Sort by usage A system files A user files E library files e Sort by data format A source files object files H executable files e Sort by access control attribution E executable-only files d-only file H read/write files Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 8 File Types Sort by usage system files user files library files Sort by data format source files object files executable files Sort by access control attribution executable-only files read-only files read/write files
Operating Systems File Types(2) Sort by fi y le logical structure H structured files H unstructured files G Sort by file physical structure w sequential files H linking files A index files Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 9 File Types (2) Sort by file logical structure structured files unstructured files Sort by file physical structure sequential files linking files index files
Operating Systems File Types (3) G uNX and windows have regular files and directories UNIX also has character and block special files. H Regular files: contain user information H Directories: system files for maintaining the structure of the file system a Character special files: related to lO r Block special files: used to model disks Regular files are generally either asci files or binary files. Gao Haichang, Software School, Xidian University 10
Operating Systems Gao Haichang , Software School, Xidian University 10 File Types (3) UNIX and Windows have regular files and directories. UNIX also has character and block special files. Regular files: contain user information. Directories: system files for maintaining the structure of the file system. Character special files: related to I/O. Block special files: used to model disks. Regular files are generally either ASCII files or binary files
Operating Systems File Types(4) Module Magic number Header Text size Data siz Date BSS size Object Symbol table size Owner module Entry point Protection Flag Header Text Object Data Relocation (a)an executable file symbol (b) An archive存档文件 Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 11 File Types (4) (a) An executable file (b) An archive 存档文件
Operating Systems File Types(exercise) In an executable file, the instructions are usually put into the text segment. header, text, data, relocation bits, symbol table Gao Haichang, Software School, Xidian University 12
Operating Systems Gao Haichang , Software School, Xidian University 12 File Types (exercise) In an executable file, the instructions are usually put into the _______ segment. header, text, data, relocation bits, symbol table text