1 / 28

EC503 - OPERATING SYSTEMS

EC503 - OPERATING SYSTEMS. FILE MANAGEMENT. Lesson Objectives. At the end of this lesson, students will be able to: Describe three types of file structures. Describe various methods of storing files. Explain how caching enhances file system performance. SUB-TOPICS. What is a File?.

zubeda
Download Presentation

EC503 - OPERATING SYSTEMS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EC503 - OPERATING SYSTEMS FILE MANAGEMENT

  2. Lesson Objectives At the end of this lesson, students will be able to: • Describe three types of file structures. • Describe various methods of storing files. • Explain how caching enhances file system performance.

  3. SUB-TOPICS

  4. What is a File? • A file is a named collection of related information, usually as a sequence of bytes, with two views: • Logical (programmer's) view, as the users see it. • Physical (operating system) view, as it actually resides on secondary storage. • Used to share data between processes. • As input to applications.

  5. What is a File? Examples of File Names and Extensions

  6. File Management System • Is defined as the system that an operating system or program uses to organize and keep track of files. • Also referred to as simply a file system. • For example, a hierarchical file system is one that uses directories to organize files into a tree structure. • Although the operating system provides its own file management system, you can buy separate file management systems. • These systems interact smoothly with the operating system but provide more features, such as improved backup procedures and stricter file protection.

  7. File Management System Operating System (OS) File Management System

  8. Objective of File System • Provide storage of data and manipulation. • Guarantee consistency of data and minimise errors. • Optimise performance (system and user). • Eliminate data loss (data destruction). • Support variety of I/O devices. • Provide a standard user interface. • Support multiple users.

  9. Examples of File Systems • UFS: Unix file system. • XFS: A 64-bit high performance journaling file system used by IRIX for disks. IRIX is Silicon Graphics' version of UNIX. • FAT: DOS standard file system, also available on OS/2 and Windows. • FAT32: newer version of FAT with 32 bit block numbers (can address up to 4+ billion blocks). • NTFS: Windows NT file system, also available on Windows 2000. • High Sierra: CD-ROM file system, standardized on most CD-ROMs. • NFS: Network file system: makes file systems available to other machines on UNIX.

  10. File Structures • Is the format/pattern into which data is arranged in a file is arranged by the computer, so that the information it contains can be retrieved on demand. • Can be classified into three: • Stream of bytes (unstructured). • Records (structured). • Tree.

  11. Stream of Bytes • OS considers a file to be unstructured. • Simplifies file management for the OS. • Applications can impose their own structure. • Used by UNIX, Windows & most modern OS.

  12. Records • Collection of bytes treated as a unit; example: employee record. • Operations at the level of records (read_rec, write_rec). • File is a collection of similar records. • OS can optimize operations on records. • Used in old systems.

  13. Tree • Records of variable length. • Each has an associated key. • Record retrieval based on key. • Used by some mainframe OS.

  14. File Structures Three kinds of files: (a) Byte sequence. (b) Record sequence. (c) Tree.

  15. Methods of Storing File • Refers to the method of allocating physical disk space for storing files data. • Also known as file system implementation. • A physical storage location on disk is known as a block. • This blocks have addresses, which is simply an integer telling which one of the blocks it is • A block address is also called a block number. • Usually each block address corresponds to exactly one sector id, but sometimes a block address corresponds to multiple sectors ids.

  16. Methods of Storing File • Can be classified into four: • Contiguous allocation. • Linked list allocation (disk blocks). • Linked list allocation (index) - DOS-FAT. • Index-nodes (i-nodes) - UNIX.

  17. Contiguous Allocation • The file is stored as a contiguous block of data allocated at file creation. (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed

  18. Contiguous Allocation • As an example, a FAT (file allocation table) system contains file name, start block, length. • Advantages: • Simple to implement (start block & length is enough to define a file). • Fast access as blocks follow each other. • Disadvantages: • Fragmentation. • Re-allocation (compaction). (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed

  19. Linked List Allocation (Disk Blocks) • The file is stored as a linked list of blocks.

  20. Linked List Allocation (Disk Blocks) • Each block contains a pointer to the next block. • In FAT, contains file name, first block address. • Advantages: • Fragmentation is eliminated. • Disadvantages: • Random access is very slow as links have to be followed.

  21. 0 1 2 3 5 7 1 3 4 5 6 7 Linked List Allocation (Index) FAT (file allocation table) Disk size EOF Free 5 Free File blocks 7 Bad First block address is in directory entry 1 … n Free

  22. Linked List Allocation (Index) • The DOS (Windows) FAT is arranged this way. • All block pointers are in FAT so that don’t take up space in actual block. • Random access is faster since FAT is always in memory. • 16-bit DOS FAT length is (65536+2)*2 = 131076 bytes.

  23. Index-Nodes (i-nodes) • In the absence of a FAT, a data structure called an i-node (index-node), which lists the attributes and disk addresses of the files blocks is used. • Indexed allocation brings all the pointers together into one location: the index block. • Each file has its own index block, which is an array of disk-block addresses.

  24. Index-Nodes (i-nodes)

  25. Index-Nodes (i-nodes)

  26. Increasing File System Performance • Use of a memory cache may speed the disk transfers between disk and process. • Blocks are read into the cache first. • Subsequent accesses are through the cache. • Blocks are swapped in & out using replacement algorithms such as FIFO. • System crashes may cause data loss if modified blocks are not written back to disk.

  27. SUMMARY • A file is a named collection of related information, usually as a sequence of bytes. • A file system is the system that an operating system or program uses to organize and keep track of files. • A file structure is the format/pattern into which data is arranged in a file is arranged by the computer. Can be classified into three: • Stream of bytes (unstructured). • Records (structured). • Tree. • A file system implementation is the method of allocating physical disk space for storing files data. Can be classified into four: • Contiguous allocation. • Linked list allocation (disk blocks). • Linked list allocation using an index (DOS - FAT). • Index-nodes (i-nodes) - (UNIX).

  28. End of Presentation! THANK YOU

More Related