Presentation is loading. Please wait.

Presentation is loading. Please wait.

File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation (5.1- 5.3 of textbook)

Similar presentations


Presentation on theme: "File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation (5.1- 5.3 of textbook)"— Presentation transcript:

1 File Systems (1)

2 Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation (5.1- 5.3 of textbook)

3 File Concept r Computers store information on various storage media m Disks, tapes r The OS provides a logical view of information storage m Define a logical storage unit: file r Files are mapped by the operating system to physical devices

4 Files r Named collection of related information recorded on secondary storage m Logical unit of storage on a device m e.g., helloworld.c, resume.doc r Can contain programs (source, binary) or data r Files have attributes: m Name, type, location, size, protection, creation time etc

5 File Naming r Files are named r Even though files are just a sequence of bytes, programs can impose structure on them m Files with a certain standard structure imposed can be identified using an extension to their name m Application programs may look for specific file extensions to indicate the file’s type m But as far as the operating system is concerned its just a sequence of bytes

6 File Naming Typical file extensions

7 File Types r Many operating systems support several types of files r UNIX, Windows have regular files and directories r Regular files: m Contain user information m Can be ASCII (e.g., source code) or binary (executable) r Directories m Maintain information on the structure of the file system

8 File Types r A file is a sequence of bytes m How does the OS know if a file can be executed? m Executable must have a specific format r In Unix the format of an executable is the following: m Header, text, data, relocation bits and symbol table r Header m Starts with the magic number identifying the file as executable m Followed by sizes of the various pieces of information m Followed by the address at which execution starts (entry point) m Followed by the text and data itself

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

10 File Access r Sequential access m Read all bytes/records from the beginning m Cannot jump around, could rewind or back up m Convenient when medium was magnetic tape r Random access m Bytes/records read in any order m Essential for database systems

11 File Attributes r Various meta-data needs to be associated with files m Owner m Creation time m Access permissions / protection m Size etc r This meta-data is referred to as the file attributes m Maintained in file system data structures for each file

12 File Attributes Possible file attributes

13 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

14 Directories r File systems use directories to keep track of files r Directory operations m File search m File creation m File deletion m Directory listing m File renaming m File system traversal

15 Single Level Directories r All files are contained in the same directory r Limitations m File names must be unique m Must ensure enough characters to make it easier to have unique file names.

16 Simple Directories r When a file is opened, the OS searches its directory until it finds the name of the file to be opened. r It then extracts the attributes and disk addresses r The OS now has all the information needed to access the file r The number of directories varies from system to system.

17 Directories Single-Level Directory Systems r A single level directory system m contains 4 files m owned by 3 different people, A, B, and C

18 Two-level Directory Systems r Letters indicate owners of the directories and files r There is a directory associated with each user

19 Hierarchical Directory Systems A hierarchical directory system

20 Path Names r Need to specify file names r Two methods: m Absolute path name: Consisting of the path from the root directory to the file m Relative path name User designates one directory as the current working directory The path name of the current working directory is implicit in the relative path name

21 A UNIX directory tree Path Names

22 Summary r This section briefly described the user interface to files and directories


Download ppt "File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation (5.1- 5.3 of textbook)"

Similar presentations


Ads by Google