Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.

Slides:



Advertisements
Similar presentations
Chapter 10: File-System Interface
Advertisements

1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Chapter 10: File-System Interface
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File-System Interface
Dr. Kalpakis CMSC 421, Operating Systems. Fall File-System Interface.
1 File Management (a). 2 File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection.
04/02/2004CSCI 315 Operating Systems Design1 File System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; File System Interface.
Chapter 12: File System Implementation
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Chapter 10: File-System Interface
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
Chapter 10: File-System Interface
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
04/05/2004CSCI 315 Operating Systems Design1 File System Implementation.
File System Implementation
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
Os111 Chapter 11 File-System Interface. os112 Outline File Concept Access Methods Directory Structure File System Mounting File Sharing Protection.
04/07/2010CSCI 315 Operating Systems Design1 File System Implementation.
03/30/2007CSCI 315 Operating Systems Design1 Virtual Memory cont’d.; File System Interface.
File Concept §Contiguous logical address space §Types: l Data: Numeric Character Binary l Program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
ICS Principles of Operating Systems Lectures 14 and 15 - FileSystem Interface and Implementation Prof. Nalini Venkatasubramanian
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Chap 10 File-System Interface. Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure File-System.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
File-System. Overview File system is the visible aspect of an OS. It provides mechanism for on-line storage of and access to both data and programs of.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Dr. T. Doom 11.1 CEG 433/633 - Operating Systems I Chapter 11: File-System Implementation File structure –Logical storage unit –Collection of related information.
Silberschatz and Galvin  Operating System Concepts File-System Implementation File-System Structure Allocation Methods Free-Space Management.
File System Implementation
Module 4.0: File Systems File is a contiguous logical address space.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
10.1 CSE Department MAITSandeep Tayal 10 :File-System Implementation File-System Structure Allocation Methods Free-Space Management Directory Implementation.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 11 File-System Implementation Slide 1 Chapter 11: File-System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 18: File-System Interface (Ch 10)
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Silberschatz and Galvin  Operating System Concepts Module 10: File-System Interface File Concept Access :Methods Directory Structure Protection.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
Access Methods File store information When it is used it is accessed & read into memory Some systems provide only one access method IBM support many access.
Allocation Methods An allocation method refers to how disk blocks are allocated for files: Contiguous allocation Linked allocation Indexed allocation.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems File System Interface.
ICS Principles of Operating Systems Lectures 14 and 15 - FileSystem Interface and Implementation Prof. Nalini Venkatasubramanian
CSE Operating System Principles File Systems.
Lecture : chapter 9 and 10 file system 1. File Concept A file is a collection of related information defined by its creator. Contiguous logical address.
File-System Implementation
Module 10: File-System Interface
Chapter 11: File-System Interface
File Sharing Sharing of files on multi-user systems is desirable
Directory Structure A collection of nodes containing information about all files Directory Files F 1 F 2 F 3 F 4 F n Both the directory structure and the.
File and File–System Management
Chapter 10: File-System Interface
Module 10: File-System Interface
Presentation transcript:

Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems

Topics Files and Directories File-System Structure Allocation Methods Free-Space Management Directory Implementation Efficiency and Performance Recovery Files and Directories File-System Structure Allocation Methods Free-Space Management Directory Implementation Efficiency and Performance Recovery

File Structure None - sequence of words, bytes Simple record structure Complex Structures Can simulate last two with first method by inserting appropriate control characters Responsible by –Operating system –Program None - sequence of words, bytes Simple record structure Complex Structures Can simulate last two with first method by inserting appropriate control characters Responsible by –Operating system –Program

File Attributes Name Type Location Size Protection Time, date, and user identification Information about files are kept in the directory structure. Name Type Location Size Protection Time, date, and user identification Information about files are kept in the directory structure.

File Operations Create Write Read Reposition within file - file seek Delete Truncate Open(F i )-search the directory structure on disk for entry F i, and move the content of entry to memory. Close(F i )-move the content of entry F i in memory to directory structure on disk. Create Write Read Reposition within file - file seek Delete Truncate Open(F i )-search the directory structure on disk for entry F i, and move the content of entry to memory. Close(F i )-move the content of entry F i in memory to directory structure on disk.

File Types Executable Object Source Code Batch Text Word processor Library Print or view Archive Executable Object Source Code Batch Text Word processor Library Print or view Archive

Access Methods Sequential Access read next write next reset no read after last write (rewrite) Sequential Access read next write next reset no read after last write (rewrite)

Access Methods (continued) Direct Access read n write n position to n read next write next rewrite n n=relative block number Direct Access read n write n position to n read next write next rewrite n n=relative block number

Directory Structure A collection of nodes containing information about all files Both the directory structure and the files reside on disk. Backups of these two structures are kept on tapes. A collection of nodes containing information about all files Both the directory structure and the files reside on disk. Backups of these two structures are kept on tapes.

Information in a Directory Name Type Address Current Length Maximum Length Date last accessed (for archival) Date last update (for dump) Owner ID (who pays) Protection information (discuss later) Name Type Address Current Length Maximum Length Date last accessed (for archival) Date last update (for dump) Owner ID (who pays) Protection information (discuss later)

Operations on a Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

Organization of the Directory Efficiency Naming Grouping Efficiency Naming Grouping

Single-Level Directory A single directory for all users. Naming problem Grouping problem A single directory for all users. Naming problem Grouping problem

Two-Level Directory Separate directory for each user Path name No naming problem Efficient searching No grouping capability Separate directory for each user Path name No naming problem Efficient searching No grouping capability

Tree-Structured Directories Efficient searching Grouping capability Current directory –cd /spell/mail/prog –cat list Efficient searching Grouping capability Current directory –cd /spell/mail/prog –cat list

Tree-Structured Directories (continued) Absolute or relative path name Creating a new file is done in current directory. Delete a file Creating a new subdirectory is done in current directory. Deleting a directory Absolute or relative path name Creating a new file is done in current directory. Delete a file Creating a new subdirectory is done in current directory. Deleting a directory

Acyclic-Graph Directories Two different names (aliasing) If dict deletes list dangling pointer. Solutions: –Backpointers, so we can delete all pointers. Variable size records a problem. –Backpointers using a daisy chain organization. –Entry-hold-count solution., Two different names (aliasing) If dict deletes list dangling pointer. Solutions: –Backpointers, so we can delete all pointers. Variable size records a problem. –Backpointers using a daisy chain organization. –Entry-hold-count solution.,

General Graph Directory How do we guarantee no cycles? –Allow only links to file not subdirectories. –Garbage collection –Every time a new link is added, use a cycle detection algorithm to determine whether it is OK. How do we guarantee no cycles? –Allow only links to file not subdirectories. –Garbage collection –Every time a new link is added, use a cycle detection algorithm to determine whether it is OK.

Protection File owner/creator should be able to control –what can be done –by whom Types of access –Read –Write –Execute –Append –Delete –List File owner/creator should be able to control –what can be done –by whom Types of access –Read –Write –Execute –Append –Delete –List

Access Lists and Groups -NFS Mode of access: read, write, execute Three classes of users RWX a) owner access RWX b) groups access RWX c) public access Ask manager to create a group (unique name), say G, and add some users to that group. Mode of access: read, write, execute Three classes of users RWX a) owner access RWX b) groups access RWX c) public access Ask manager to create a group (unique name), say G, and add some users to that group.

Access Lists and Groups (continued) For a particular file (say game) or subdirectory, define an appropriate access. Attach a group to that file chgrp G game For a particular file (say game) or subdirectory, define an appropriate access. Attach a group to that file chgrp G game owner group public chmod 761 game

File-System Structure File structure File system resides on secondary storage File system organized into layers. File control block - storage structure consisting of information about a file. File structure File system resides on secondary storage File system organized into layers. File control block - storage structure consisting of information about a file.

Contiguous Allocation Each file occupies a set of contiguous blocks on the disk. Simple-only starting location (block #) and length (number of blocks) are required. Random Access. Wasteful of space (dynamic storage-allocation problem). Each file occupies a set of contiguous blocks on the disk. Simple-only starting location (block #) and length (number of blocks) are required. Random Access. Wasteful of space (dynamic storage-allocation problem).

Contiguous Allocation (continued) Files cannot grow Mapping from logical to physical. Starting address and displacement. Files cannot grow Mapping from logical to physical. Starting address and displacement.

Linked Allocation Each file is a linked list of disk blocks; blocks may be scattered anywhere on the disk. Block = pointer

Linked Allocation Simple - need only starting address Free-space management system - no waste of space No random access Mapping File-allocation table (FAT) - disk-space allocation used by MS-DOS and OS/2. Simple - need only starting address Free-space management system - no waste of space No random access Mapping File-allocation table (FAT) - disk-space allocation used by MS-DOS and OS/2.

Indexed Allocation Brings all pointers together into the index block. Logical view Brings all pointers together into the index block. Logical view

Indexed Allocation (continued) Need index table Random access Dynamic access without external fragmentation, but have overhead of index block. Mapping from logical to physical in a file of maximum size of 256K words and block size of 512 words. We need only 1 block for index table –Q –R Need index table Random access Dynamic access without external fragmentation, but have overhead of index block. Mapping from logical to physical in a file of maximum size of 256K words and block size of 512 words. We need only 1 block for index table –Q –R

Indexed Allocation- Mapping (continued) Mapping from logical to physical in a file of unbounded length (block size of 512 words). Linked scheme - Link blocks of index tables (no limit on size). LA / (512 x 511) Mapping from logical to physical in a file of unbounded length (block size of 512 words). Linked scheme - Link blocks of index tables (no limit on size). LA / (512 x 511) Q1R1Q1R1

Indexed Allocation - Mapping (continued) –Q 1 = block of index table –R 1 is used as follows: R 1 / 512 –Q 2 = displacement into block of index table. –R 2 = displacement into block of file. –Q 1 = block of index table –R 1 is used as follows: R 1 / 512 –Q 2 = displacement into block of index table. –R 2 = displacement into block of file. Q2R2Q2R2

Indexed Allocation - Mapping (continued) Two-level index (maximum file size is ) LA / (512 x 512) –Q 1 = displacement into outer-index –R 1 is used as follows: R 1 / 512 Two-level index (maximum file size is ) LA / (512 x 512) –Q 1 = displacement into outer-index –R 1 is used as follows: R 1 / 512 Q1R1Q1R1 Q2R2Q2R2

Indexed Allocation - Mapping (continued) –Q 2 = displacement into block of index table –R 2 = displacement into block of file –Q 2 = displacement into block of index table –R 2 = displacement into block of file

Indexed Allocation - Mapping (continued) outer- index index table file

Combined Scheme: UNIX (4K bytes per block) Mode owners (2) timestamps (3) size block count direct blocks single indirect double indirect triple indirect data

Free-Space Management Bit vector (n blocks) bit[ i ] = Bit vector (n blocks) bit[ i ] = 01 2 n block [ i ] free 1 block [ i ] occupied

Free-Space Management (continued) Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit Bit map requires extra space. Example block size = 2 12 bytes disk size = 2 30 bytes ( 1 gigabyte) n = 2 30 /2 12 =2 18 (or 32K bytes) Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit Bit map requires extra space. Example block size = 2 12 bytes disk size = 2 30 bytes ( 1 gigabyte) n = 2 30 /2 12 =2 18 (or 32K bytes)

Free-Space Management (continued) Easy to get contiguous files Linked list (free list) –Cannot get contiguous space easily –No waste of space Grouping Counting Easy to get contiguous files Linked list (free list) –Cannot get contiguous space easily –No waste of space Grouping Counting

Free-Space Management (continued) Need to protect –Pointer to free list –Bit map Must be kept on disk Copy in memory and disk may differ Cannot allow for block [ i ] to have a situation where bit [ i ] = 1 in memory and bit [ i ] = 0 on disk. Need to protect –Pointer to free list –Bit map Must be kept on disk Copy in memory and disk may differ Cannot allow for block [ i ] to have a situation where bit [ i ] = 1 in memory and bit [ i ] = 0 on disk.

Free-Space Management (continued) –Solution Set bit [ i ] = 1 in disk. Allocate block [ i ]. Set bit [ i ] = 1 in memory. –Solution Set bit [ i ] = 1 in disk. Allocate block [ i ]. Set bit [ i ] = 1 in memory.

Directory Implementation Linear list of file names with pointers to the data blocks Hash Table - linear list with hash data structure. Linear list of file names with pointers to the data blocks Hash Table - linear list with hash data structure.