SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
File-System Interface
   File Concept
   Access Methods
   Directory Structure
   File-System Mounting
   File Sharing
   Protection
1. File Concept
• A file is a named collection of related information that is
  recorded on secondary storage
• User's perspective, a tile is the smallest allotment of
  logical secondary storage i.e., data cannot be written to
  secondary storage unless they are within a file
• Types of information may be stored in a file
   – Data – numeric , character, binary
   – Program – Source, Object, Executable
• A file has a defined structure depends on its type
   – A Source file is a sequence of subroutines and functions
   – An Object file is a sequence of bytes
   – An Executable file is a series of code sections


                       Loganathan R, CSE, HKBKCE                2
1. File Concept
1.1 File Attributes
Vary from one OS to another, but consists:
• Name – only information kept in human-readable form
• Identifier – unique tag (number) identifies file within
  file system (non-human-readable name)
• Type – needed for systems that support different types
• Location – pointer to file location on device
• Size – current file size
• Protection – controls who can do reading, writing,
  executing
• Time, date, and user identification – data for
  protection, security, and usage monitoring
• Information about files are kept in the directory
  structure, which is maintained on the disk
                     Loganathan R, CSE, HKBKCE              3
1. File Concept Cntd…
1.2 File Operations
File is an abstract data type OS System calls for operations
• Creating a file – 2 steps: Find space in the file system for the file and an
    entry in the directory
• Writing a file - name of the file and the information to be written to the file
• Read - name of the file and where (in memory)the next block of the file,
    read pointer to the location of next read, per-process current file- position
    pointer
• Reposition within file - current-file-position pointer is repositioned to a
    given value, also known as a file seek
• Deleting a file - release all file space and erase the directory entry
• Truncating a file - all attributes to remain unchanged—except for file length
• appending new information to the end of an existing file
• renaming an existing file
• copy of a file
• Open(Fi) – search the directory structure on disk for entry Fi, and move the
    content of entry to memory
• Close (Fi) – move the content of entry Fi in memory to directory structure on
    disk
                            Loganathan R, CSE, HKBKCE                        4
1. File Concept Cntd…
Open file table
•   Contains information about all open files
     – File pointer: pointer to last read/write location, per process that has the file open
     – File-open count: counter of number of times a file is open – to allow removal of data from
       open-file table when last processes closes it
     – Disk location of the file: cache of data access information
     – Access rights: per-process access mode information
File locks
•   Allow one process to lock a file and prevent other processes from gaining access to
    it.
•   Useful for files that are shared by several processes(eg. System log file)
•   A shared lock is similar to a reader lock , several processes can acquire the lock
    concurrently
•   An exclusive lock behaves like a writer lock only one process at a time can acquire
•   A Mandatory lock– once a process acquires an exclusive lock, the OS will prevent
    any other process from accessing the locked file
•   An Advisory lock– processes can find status of locks and decide what to do




                                     Loganathan R, CSE, HKBKCE                                      5
1. File Concept Cntd…
1.3 File Types
• OS should recognize and
  support file types, so that
  it can then operate on the
  file in reasonable ways
• Common technique for
  implementing file types is
  to include the type as
  part of the file name
• The name is split into two
  parts—a name and an
  extension, separated by a
  period character




                                Loganathan R, CSE, HKBKCE   6
2. Access Methods
2.1 Sequential Access
• Information in the file is processed in order, one record after the other
• read next—reads the next portion of the file and automatically advances
   a file pointer
• write next—appends to the end of the file
• reset - to the beginning
• forward or backward n records




                            Loganathan R, CSE, HKBKCE                         7
2. Access Methods                       Contd…


2.2 Direct Access / relative access
• A file is made up of fixed length logical records that allow programs to read
  and write records rapidly in no particular order
• File operations modified to include the block number as a parameter
• Block number provided by the user to the OS is a relative block number
• A relative block number is an index relative to the beginning of the file




                             Loganathan R, CSE, HKBKCE                        8
2. Access Methods                       Contd…

2.3 Other Access Methods
• Built on top of a direct-access method
• Example of Index and Relative Files




                             Loganathan R, CSE, HKBKCE            9
3. Directory Structure
A collection of nodes containing information about all file
3.1 Storage Structure
• Both the directory structure and the files reside on disk
• Parts of a disk(partitions, slices, or minidisks) is used for a file system and other
  parts for other things
• The parts can also be combined to form larger structures known as volumes
• A device directory or volume table of contents commonly
• Known as a directory records information—such as name, location, size, and type—
  for all files on that volume




                                Loganathan R, CSE, HKBKCE                          10
               A typical file-system organization
3. Directory Structure                         Cntd…

3.2 Operations Performed on Directory
• Search for a file - able to search a directory structure to find the entry for a
   particular file
• Create a file - New files to be created and added to the directory
• Delete a file – remove it from the directory
• List a directory - able to list the files in a directory and the contents of the
   directory entry for each file
• Rename a file - change the name when the contents or use of the file
   changes
• Traverse the file system - access every directory and every file within a
   directory structure
3.3 Single-Level Directory




 Naming and Grouping problem Since all files are in the same directory
                             Loganathan R, CSE, HKBKCE                         11
3. Directory Structure                     Cntd…

3.4 Two-Level Directory
• Separate directory for each user user file directory (UFD)
• Master file directory (MFD) – All UFD entries




  Path name
  Can have the same file name for different user
  Efficient searching
  No grouping capability



                            Loganathan R, CSE, HKBKCE           12
3. Directory Structure                       Cntd…
3.5 Tree-Structured Directories
 Efficient searching , Grouping Capability
Current directory (working directory)
cd /spell/mail/prog
type list




                                  Loganathan R, CSE, HKBKCE           13
3. Directory Structure                      Cntd…

• Efficient searching and Grouping Capability
• Current directory (working directory)
  cd /spell/mail/prog
  type list
• Absolute path begins at the root and follows a path down to the specified file
• Relative path defines path from the current directory
• Creating a new file is done in current directory
• Delete a file
                    rm <file-name>
• Creating a new subdirectory is done in current directory
                   mkdir <dir-name>
   Example: if in current directory /mail
                       mkdir count
                                   mail

                      prog   copy prt exp count

     Deleting “mail”  deleting the entire subtree rooted by “mail”
                              Loganathan R, CSE, HKBKCE                      14
3. Directory Structure                     Cntd…
3.6 Acyclic-Graph Directories
• Have shared subdirectories and files i.e. changes made by one is immediately
   visible to the other
• New directory entry type
    Link – another name (pointer)
    to an existing file
    Resolve the link – follow
    pointer to locate the file
• Deletion of a link need
  not affect the original file
• File entry is deleted, the
  space for the file is
  deallocated, leaving the
  links dangling
• Preserve the file until all
  references to it are
  deleted.




                                 Loganathan R, CSE, HKBKCE                 15
3. Directory Structure                      Cntd…

3.7 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




                                                                            16
                            Loganathan R, CSE, HKBKCE
4.File System Mounting
• A file system must be mounted before it can be accessed
• A unmounted file system (b) is mounted at a mount point




                                                            Mount point.



Existing system                Unmounted volume
                          Loganathan R, CSE, HKBKCE                  17
5. File Sharing
• Sharing of files on multi-user systems is desirable
• Sharing may be done through a protection scheme
• On distributed systems, files may be shared across a
  network
• Network File System (NFS) is a common distributed
  file-sharing method
5.1 Multiple Users
• User IDs (Owner)identify users, allowing permissions
  and protections to be per-user
• Group IDs allow users to be in groups, permitting
  group access rights

                    Loganathan R, CSE, HKBKCE        18
5. File Sharing
5.2 Remote File Systems
• Uses networking to allow file system access between systems
  – Manually via programs like FTP
  – Automatically, seamlessly using distributed file systems
  – Semi automatically via the world wide web
• Client-server model allows clients to mount remote file systems from servers
  – Server can serve multiple clients
  – Client and user-on-client identification is insecure or complicated
• NFS is standard UNIX client-server file sharing protocol allow many-to-many
   relationships.
• Distributed Information Systems (distributed naming services) such as LDAP(Light-
  weight Directory Access Protocol), DNS(Domain Name System), NIS(Network
  Information Service), Active Directory implement unified access to information
  needed for remote computing
• Failure Modes
 – Remote file systems add new failure modes, due to network failure, server failure
 – Recovery from failure can involve state information about status of each remote
   request
 – Stateless protocols such as NFS include all information in each request, allowing easy
   recovery but less security
                                Loganathan R, CSE, HKBKCE                            19
File Sharing – Consistency Semantics
• Consistency semantics specify how multiple users are
  to access a shared file simultaneously
   – Similar to process synchronization algorithms
      • Tend to be less complex due to disk I/O and network latency (for
        remote file systems
   – Andrew File System (AFS) implemented complex remote file
     sharing semantics
   – Unix file system (UFS) implements:
      • Writes to an open file visible immediately to other users of the same
        open file
      • Sharing file pointer to allow multiple users to read and write
        concurrently
   – AFS has session semantics
      • Writes only visible to sessions starting after the file is closed



                            Loganathan R, CSE, HKBKCE                       20
Protection
• File owner/creator should be able to control:
  – what can be done
  – by whom
• Types of access
  – Read
  – Write
  – Execute
  – Append
  – Delete
  – List
                    Loganathan R, CSE, HKBKCE     21
Access Lists and Groups
•   Mode of access: read, write, execute
•   Three classes of users
                                                                         RWX
                        a) owner access                 7               111
                                                                         RWX
                        b) group access                 6               110
                                                                         RWX
                        c) public access                1               001
•   Ask manager to create a group (unique name), say G, and add some
    users to the group.
•   For a particular file (say game) or subdirectory, define an appropriate
    access.



                               owner    group     public


                                chmod   761     game




                               Loganathan R, CSE, HKBKCE                       22
Windows XP Access-control List Management




             Loganathan R, CSE, HKBKCE      23

Mais conteúdo relacionado

Mais procurados

Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
myrajendra
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
Ravindra Raju Kolahalam
 

Mais procurados (20)

Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Process management os concept
Process management os conceptProcess management os concept
Process management os concept
 
Directory structure
Directory structureDirectory structure
Directory structure
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
 
3.9 external sorting
3.9 external sorting3.9 external sorting
3.9 external sorting
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
File system Os
File system OsFile system Os
File system Os
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Reader Writer problem
Reader Writer problemReader Writer problem
Reader Writer problem
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
File Protection in Operating System
File Protection in Operating SystemFile Protection in Operating System
File Protection in Operating System
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
DBMS
DBMSDBMS
DBMS
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 

Destaque

Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
Sonali Chauhan
 
Kobie Quarterly Review: Retail Edition, June 2013
Kobie Quarterly Review: Retail Edition, June 2013Kobie Quarterly Review: Retail Edition, June 2013
Kobie Quarterly Review: Retail Edition, June 2013
Jennifer Lingerfelt
 

Destaque (20)

Ch11: File System Interface
Ch11: File System InterfaceCh11: File System Interface
Ch11: File System Interface
 
7 Deadlocks
7 Deadlocks7 Deadlocks
7 Deadlocks
 
4 threads
4 threads4 threads
4 threads
 
3 process management
3 process management3 process management
3 process management
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
File management
File managementFile management
File management
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock Galvin
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
OSCh11
OSCh11OSCh11
OSCh11
 
File Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.SivakumarFile Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.Sivakumar
 
FINAL DEMO TOPIC
FINAL DEMO TOPICFINAL DEMO TOPIC
FINAL DEMO TOPIC
 
TKP notes for Java
TKP notes for JavaTKP notes for Java
TKP notes for Java
 
File Systems
File SystemsFile Systems
File Systems
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Kobie Quarterly Review: Retail Edition, June 2013
Kobie Quarterly Review: Retail Edition, June 2013Kobie Quarterly Review: Retail Edition, June 2013
Kobie Quarterly Review: Retail Edition, June 2013
 
Guide To Qrops Pension Planning
Guide To Qrops Pension PlanningGuide To Qrops Pension Planning
Guide To Qrops Pension Planning
 

Semelhante a 10 File System

3. distributed file system requirements
3. distributed file system requirements3. distributed file system requirements
3. distributed file system requirements
AbDul ThaYyal
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
BUSHRASHAIKH804312
 

Semelhante a 10 File System (20)

File System.pptx
File System.pptxFile System.pptx
File System.pptx
 
Os6
Os6Os6
Os6
 
File system
File systemFile system
File system
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
Ch10 file system interface
Ch10   file system interfaceCh10   file system interface
Ch10 file system interface
 
File system in operating system e learning
File system in operating system e learningFile system in operating system e learning
File system in operating system e learning
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file management
 
5263802.ppt
5263802.ppt5263802.ppt
5263802.ppt
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptx
 
3. distributed file system requirements
3. distributed file system requirements3. distributed file system requirements
3. distributed file system requirements
 
Windowsforensics
WindowsforensicsWindowsforensics
Windowsforensics
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
File management in OS
File management in OSFile management in OS
File management in OS
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
 
File system1.pptx
File system1.pptxFile system1.pptx
File system1.pptx
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 

Mais de Dr. Loganathan R

Mais de Dr. Loganathan R (20)

Ch 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdfCh 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdf
 
IoT Sensing and Actuation.pdf
 IoT Sensing and Actuation.pdf IoT Sensing and Actuation.pdf
IoT Sensing and Actuation.pdf
 
Ch 4 Emergence of IoT.pdf
Ch 4 Emergence of IoT.pdfCh 4 Emergence of IoT.pdf
Ch 4 Emergence of IoT.pdf
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
 
Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2
 
Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3
 
Bcsl 033 data and file structures lab s4-2
Bcsl 033 data and file structures lab s4-2Bcsl 033 data and file structures lab s4-2
Bcsl 033 data and file structures lab s4-2
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3
 
Bcsl 033 data and file structures lab s3-2
Bcsl 033 data and file structures lab s3-2Bcsl 033 data and file structures lab s3-2
Bcsl 033 data and file structures lab s3-2
 
Bcsl 033 data and file structures lab s3-1
Bcsl 033 data and file structures lab s3-1Bcsl 033 data and file structures lab s3-1
Bcsl 033 data and file structures lab s3-1
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
 
Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1
 
Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4
 
Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2
 
Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1
 
Introduction to Information Security
Introduction to Information SecurityIntroduction to Information Security
Introduction to Information Security
 

10 File System

  • 1. File-System Interface File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection
  • 2. 1. File Concept • A file is a named collection of related information that is recorded on secondary storage • User's perspective, a tile is the smallest allotment of logical secondary storage i.e., data cannot be written to secondary storage unless they are within a file • Types of information may be stored in a file – Data – numeric , character, binary – Program – Source, Object, Executable • A file has a defined structure depends on its type – A Source file is a sequence of subroutines and functions – An Object file is a sequence of bytes – An Executable file is a series of code sections Loganathan R, CSE, HKBKCE 2
  • 3. 1. File Concept 1.1 File Attributes Vary from one OS to another, but consists: • Name – only information kept in human-readable form • Identifier – unique tag (number) identifies file within file system (non-human-readable name) • Type – needed for systems that support different types • Location – pointer to file location on device • Size – current file size • Protection – controls who can do reading, writing, executing • Time, date, and user identification – data for protection, security, and usage monitoring • Information about files are kept in the directory structure, which is maintained on the disk Loganathan R, CSE, HKBKCE 3
  • 4. 1. File Concept Cntd… 1.2 File Operations File is an abstract data type OS System calls for operations • Creating a file – 2 steps: Find space in the file system for the file and an entry in the directory • Writing a file - name of the file and the information to be written to the file • Read - name of the file and where (in memory)the next block of the file, read pointer to the location of next read, per-process current file- position pointer • Reposition within file - current-file-position pointer is repositioned to a given value, also known as a file seek • Deleting a file - release all file space and erase the directory entry • Truncating a file - all attributes to remain unchanged—except for file length • appending new information to the end of an existing file • renaming an existing file • copy of a file • Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory • Close (Fi) – move the content of entry Fi in memory to directory structure on disk Loganathan R, CSE, HKBKCE 4
  • 5. 1. File Concept Cntd… Open file table • Contains information about all open files – File pointer: pointer to last read/write location, per process that has the file open – File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it – Disk location of the file: cache of data access information – Access rights: per-process access mode information File locks • Allow one process to lock a file and prevent other processes from gaining access to it. • Useful for files that are shared by several processes(eg. System log file) • A shared lock is similar to a reader lock , several processes can acquire the lock concurrently • An exclusive lock behaves like a writer lock only one process at a time can acquire • A Mandatory lock– once a process acquires an exclusive lock, the OS will prevent any other process from accessing the locked file • An Advisory lock– processes can find status of locks and decide what to do Loganathan R, CSE, HKBKCE 5
  • 6. 1. File Concept Cntd… 1.3 File Types • OS should recognize and support file types, so that it can then operate on the file in reasonable ways • Common technique for implementing file types is to include the type as part of the file name • The name is split into two parts—a name and an extension, separated by a period character Loganathan R, CSE, HKBKCE 6
  • 7. 2. Access Methods 2.1 Sequential Access • Information in the file is processed in order, one record after the other • read next—reads the next portion of the file and automatically advances a file pointer • write next—appends to the end of the file • reset - to the beginning • forward or backward n records Loganathan R, CSE, HKBKCE 7
  • 8. 2. Access Methods Contd… 2.2 Direct Access / relative access • A file is made up of fixed length logical records that allow programs to read and write records rapidly in no particular order • File operations modified to include the block number as a parameter • Block number provided by the user to the OS is a relative block number • A relative block number is an index relative to the beginning of the file Loganathan R, CSE, HKBKCE 8
  • 9. 2. Access Methods Contd… 2.3 Other Access Methods • Built on top of a direct-access method • Example of Index and Relative Files Loganathan R, CSE, HKBKCE 9
  • 10. 3. Directory Structure A collection of nodes containing information about all file 3.1 Storage Structure • Both the directory structure and the files reside on disk • Parts of a disk(partitions, slices, or minidisks) is used for a file system and other parts for other things • The parts can also be combined to form larger structures known as volumes • A device directory or volume table of contents commonly • Known as a directory records information—such as name, location, size, and type— for all files on that volume Loganathan R, CSE, HKBKCE 10 A typical file-system organization
  • 11. 3. Directory Structure Cntd… 3.2 Operations Performed on Directory • Search for a file - able to search a directory structure to find the entry for a particular file • Create a file - New files to be created and added to the directory • Delete a file – remove it from the directory • List a directory - able to list the files in a directory and the contents of the directory entry for each file • Rename a file - change the name when the contents or use of the file changes • Traverse the file system - access every directory and every file within a directory structure 3.3 Single-Level Directory Naming and Grouping problem Since all files are in the same directory Loganathan R, CSE, HKBKCE 11
  • 12. 3. Directory Structure Cntd… 3.4 Two-Level Directory • Separate directory for each user user file directory (UFD) • Master file directory (MFD) – All UFD entries  Path name  Can have the same file name for different user  Efficient searching  No grouping capability Loganathan R, CSE, HKBKCE 12
  • 13. 3. Directory Structure Cntd… 3.5 Tree-Structured Directories Efficient searching , Grouping Capability Current directory (working directory) cd /spell/mail/prog type list Loganathan R, CSE, HKBKCE 13
  • 14. 3. Directory Structure Cntd… • Efficient searching and Grouping Capability • Current directory (working directory) cd /spell/mail/prog type list • Absolute path begins at the root and follows a path down to the specified file • Relative path defines path from the current directory • Creating a new file is done in current directory • Delete a file rm <file-name> • Creating a new subdirectory is done in current directory mkdir <dir-name> Example: if in current directory /mail mkdir count mail prog copy prt exp count Deleting “mail”  deleting the entire subtree rooted by “mail” Loganathan R, CSE, HKBKCE 14
  • 15. 3. Directory Structure Cntd… 3.6 Acyclic-Graph Directories • Have shared subdirectories and files i.e. changes made by one is immediately visible to the other • New directory entry type Link – another name (pointer) to an existing file Resolve the link – follow pointer to locate the file • Deletion of a link need not affect the original file • File entry is deleted, the space for the file is deallocated, leaving the links dangling • Preserve the file until all references to it are deleted. Loganathan R, CSE, HKBKCE 15
  • 16. 3. Directory Structure Cntd… 3.7 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 16 Loganathan R, CSE, HKBKCE
  • 17. 4.File System Mounting • A file system must be mounted before it can be accessed • A unmounted file system (b) is mounted at a mount point Mount point. Existing system Unmounted volume Loganathan R, CSE, HKBKCE 17
  • 18. 5. File Sharing • Sharing of files on multi-user systems is desirable • Sharing may be done through a protection scheme • On distributed systems, files may be shared across a network • Network File System (NFS) is a common distributed file-sharing method 5.1 Multiple Users • User IDs (Owner)identify users, allowing permissions and protections to be per-user • Group IDs allow users to be in groups, permitting group access rights Loganathan R, CSE, HKBKCE 18
  • 19. 5. File Sharing 5.2 Remote File Systems • Uses networking to allow file system access between systems – Manually via programs like FTP – Automatically, seamlessly using distributed file systems – Semi automatically via the world wide web • Client-server model allows clients to mount remote file systems from servers – Server can serve multiple clients – Client and user-on-client identification is insecure or complicated • NFS is standard UNIX client-server file sharing protocol allow many-to-many relationships. • Distributed Information Systems (distributed naming services) such as LDAP(Light- weight Directory Access Protocol), DNS(Domain Name System), NIS(Network Information Service), Active Directory implement unified access to information needed for remote computing • Failure Modes – Remote file systems add new failure modes, due to network failure, server failure – Recovery from failure can involve state information about status of each remote request – Stateless protocols such as NFS include all information in each request, allowing easy recovery but less security Loganathan R, CSE, HKBKCE 19
  • 20. File Sharing – Consistency Semantics • Consistency semantics specify how multiple users are to access a shared file simultaneously – Similar to process synchronization algorithms • Tend to be less complex due to disk I/O and network latency (for remote file systems – Andrew File System (AFS) implemented complex remote file sharing semantics – Unix file system (UFS) implements: • Writes to an open file visible immediately to other users of the same open file • Sharing file pointer to allow multiple users to read and write concurrently – AFS has session semantics • Writes only visible to sessions starting after the file is closed Loganathan R, CSE, HKBKCE 20
  • 21. Protection • File owner/creator should be able to control: – what can be done – by whom • Types of access – Read – Write – Execute – Append – Delete – List Loganathan R, CSE, HKBKCE 21
  • 22. Access Lists and Groups • Mode of access: read, write, execute • Three classes of users RWX a) owner access 7  111 RWX b) group access 6  110 RWX c) public access 1  001 • Ask manager to create a group (unique name), say G, and add some users to the group. • For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game Loganathan R, CSE, HKBKCE 22
  • 23. Windows XP Access-control List Management Loganathan R, CSE, HKBKCE 23