Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 File Systems Chapter 6 6.1 Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.

Similar presentations


Presentation on theme: "1 File Systems Chapter 6 6.1 Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems."— Presentation transcript:

1 1 File Systems Chapter 6 6.1 Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems

2 2 Long-term Information Storage 1.Must store large amounts of data (virtual address space may not be big enough) 2.Information stored must survive the termina- tion of the process using it, or if the computer crashes 3.Multiple processes must be able to access the information concurrently Files are managed by the OS. Structure, management, naming, accessing, etc, are part of the file system.

3 3 File Naming Characters, digits, special characters Lower case and upper case letters File extensions (e.g. prog.c, prog.c.Z) Unix: extensions mean nothing, however certain programs may require specific extensions Windows: aware of extensions – assigns meaning. Programs “own” extensions.

4 4 File Naming Typical file extensions.

5 5 File Structure Three kinds of files –byte sequence – no meaning for OS, meaning at user level –record sequence – fixed length, structure (e.g. card images) –tree – each has a key field, tree is sorted on that key

6 6 File Types Regular files: the ones that contain user information Directories: system files to maintain system’s structure Unix: Character and Block special files Regular files: –ASCII (plain text) –binary (internal structure) Every OS must at least recognize its own executable file

7 7 File Types (a) An executable file (b) An archive

8 8 File Access Sequential access –read all bytes/records from the beginning –cannot jump around, could rewind or back up –convenient when medium was magnetic tape Random access –bytes/records read in any order –essential for data base systems –read can be done in 2 ways give the position in the file and initiate a read move file marker (seek) to set current position and then read

9 9 File Attributes Possible file attributes

10 10 File Operations 1.Create 2.Delete 3.Open 4.Close 5.Read 6.Write 7.Append 8.Seek 9.Get attributes 10.Set Attributes 11.Rename

11 11 An Example Program Using File System Calls (1/2)

12 12 An Example Program Using File System Calls (2/2)

13 13 Memory-Mapped Files Segmented process before mapping files into its address space Process after mapping –existing file abc into one segment –creating new segment for xyz Problems: the usual ones Motivation: access files in a uniform way

14 14 Directories Single-Level Directory Systems A single level directory system –contains 4 files –owned by 3 different people, A, B, and C Potential problem: same filenames

15 15 Two-level Directory Systems Each user gets a private directory; letters indicate owners of the directories and files When a user tries to open a file, system knows which user is Users may want to access files in other users’ directories

16 16 Hierarchical Directory Systems A hierarchical directory system

17 17 Path Names If file system is a directory tree => naming scheme? Two methods to specify file names: –absolute paths: path from root to file (e.g. /usr/ast/mailbox) –relative paths: used in conjunction with the working or current directory. User (or process) specifies a directory as current and all paths (not beginning with the separator) are taken relative to that (e.g. ast/mailbox, if current = “/usr/”) Each process has its own working directory Library procedures rarely change the working directory. (dot) and.. (dotdot) directories: current and parent directories

18 18 A UNIX directory tree Path Names

19 19 Directory Operations 1.Create 2.Delete 3.Opendir 4.Closedir 5.Readdir 6.Rename 7.Link 8.Unlink


Download ppt "1 File Systems Chapter 6 6.1 Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems."

Similar presentations


Ads by Google