File Systems

File Systems
Slide Note
Embed
Share

File systems are essential components of operating systems, providing structure and organization for data storage. This content delves into the evolution and functionalities of file systems, covering aspects such as file storage media, file naming conventions, file contents, and alternatives to traditional file organization methods. Explore the fundamental concepts and principles behind file systems in this comprehensive guide.

  • File Systems
  • Operating Systems
  • Data Storage
  • File Naming
  • File Contents

Uploaded on Feb 27, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. File Systems David Ferry CSCI 3500 Operating Systems Saint Louis University St. Louis, MO 63103 1

  2. Motivation Early machines did not have file systems! Data was input manually Output was printed to hardcopy Physical process memory is insufficient: Limited to size of RAM RAM is volatile Process memory is isolated- how to share information between processes? CSCI 3500 - Operating Systems 2

  3. File Storage Media Hard drives / Solid-state drives / Flash CD / DVD / etc. Reel-to-reel magnetic tape These are abstracted as block devices: Conceptually a large array of fixed size blocks 0 1 2 3 4 5 6 7 8 512 bytes Supports two operations: read block, write block The file system imposes a file structure on these devices: 1. How do you find information you need? 2. How do you enforce protection? 3. How do you find free blocks and create new files?

  4. What is a File? There are a lot of different use cases! Normal files Virtual files E.g. process-to-process communication E.g. cat /proc/cpuinfo Hardware device I/O All files have at least: 1. Unique name 2. Contents 3. Attributes CSCI 3500 - Operating Systems 4

  5. File Naming No real standards Early systems only had space for 8-byte names Length has grown over time, support for special characters, etc. Modern systems support links/shortcuts File extensions? (E.g.- .txt .exe .pdf .docx etc.) Not enforced on Unix- programs are identified by contents and not by name (e.g. magic bytes) Some programs may care Windows cares a lot about extensions CSCI 3500 - Operating Systems 5

  6. File Contents Strong modern convention: Files are byte-addressable An open file starts with a file pointer at the start, but this file pointer moves based on read(), write(), seek(), etc. File contents are not organized by the OS Some C library functions like fgetl() will have content-dependent behavior, but these are written on top of the read() system call. Gives a lot of flexibility to application developers, but is not particularly efficient. File.txt File 72 Pointer 69 76 76 79 32 87 CSCI 3500 - Operating Systems 6

  7. Content Alternatives It doesn t have to be that way Records: OS-level file interactions take place as larger block interactions E.g. A popular early system used 80-byte punch cards Keyed Data or Content-Addressable Data: Data is organized by file & key rather than file & location E.g. database systems K Data File.txt 80-byte blocks K Data K Data K Data K Data CSCI 3500 - Operating Systems 7

  8. Example File Format Most files take their structure by convention: Magic # ELF Executable and Linkable Format Binary file format for programs, object files, and libraries Text Size Data Size BSS Size Contents: 1. Magic Number 4-byte sequence 0x7F E L F 2. Text Size 3. Data Size 4. BSS (uninitialized data) Size 5. Symbol table Size 6. Entry point Symbol Table Size Entry Point .text .data Symbol Table CSCI 3500 - Operating Systems 8

  9. BSS Segment Initialized vs. Uninitialized Data: Initialized: int x = 12; Uninitialized: int x; int array [1000]; Initialized data has to be saved by the compiler, uninitialized data does not. CSCI 3500 - Operating Systems 9

  10. See ELF Files for yourself 1. Try opening a binary file in a text editor such as vi or emacs 2. Use readelf I ve been lying to you about the canonical layout of programs in memory still basically correct, but there s a lot more there too. .stack .heap .data .text CSCI 3500 - Operating Systems 10

More Related Content