SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

File system Os
File system OsFile system Os
File system OsNehal Naik
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.Muhammad SiRaj Munir
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating SystemJanki Shah
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory StructureKevin OBrien
 
Memory management
Memory managementMemory management
Memory managementcpjcollege
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating SystemMeghaj Mallick
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in LinuxHenry Osborne
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mountingrajshreemuthiah
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memorysgpraju
 
Case study operating systems
Case study operating systemsCase study operating systems
Case study operating systemsAkhil Bevara
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access methodrajshreemuthiah
 
NTFS file system
NTFS file systemNTFS file system
NTFS file systemRavi Yasas
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsMukesh Chinta
 

La actualidad más candente (20)

File system Os
File system OsFile system Os
File system Os
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
Basic Unix
Basic UnixBasic Unix
Basic Unix
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 
Memory management
Memory managementMemory management
Memory management
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Case study operating systems
Case study operating systemsCase study operating systems
Case study operating systems
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
NTFS file system
NTFS file systemNTFS file system
NTFS file system
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
Memory management
Memory managementMemory management
Memory management
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
 

Destacado

Ch11: File System Interface
Ch11: File System InterfaceCh11: File System Interface
Ch11: File System InterfaceAhmar Hashmi
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Operating System Deadlock Galvin
Operating System  Deadlock GalvinOperating System  Deadlock Galvin
Operating System Deadlock GalvinSonali Chauhan
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)anandvaidya
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt onu9
 
File Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.SivakumarFile Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.SivakumarSivakumar R D .
 
FINAL DEMO TOPIC
FINAL DEMO TOPICFINAL DEMO TOPIC
FINAL DEMO TOPICbunso18
 
TKP notes for Java
TKP notes for JavaTKP notes for Java
TKP notes for JavaLynn Langit
 
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 2013Jennifer Lingerfelt
 
Guide To Qrops Pension Planning
Guide To Qrops Pension PlanningGuide To Qrops Pension Planning
Guide To Qrops Pension Planninggregsmithhk
 

Destacado (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
 

Similar a 10 File System

File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control YuvrajWadavale
 
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 learningLavanya Sharma
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file managementKalai Selvi
 
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 SystemSneh Prabha
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxNavyaKumar22
 
3. distributed file system requirements
3. distributed file system requirements3. distributed file system requirements
3. distributed file system requirementsAbDul ThaYyal
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file managementKalai Selvi
 
File management in OS
File management in OSFile management in OS
File management in OSBhavik Vashi
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.pptBUSHRASHAIKH804312
 
File system1.pptx
File system1.pptxFile system1.pptx
File system1.pptxSamar954063
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksZubair Nabi
 

Similar 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
 
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
File ManagementFile Management
File Management
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
 

Más de Dr. Loganathan R

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.pdfDr. Loganathan R
 
IoT Sensing and Actuation.pdf
 IoT Sensing and Actuation.pdf IoT Sensing and Actuation.pdf
IoT Sensing and Actuation.pdfDr. Loganathan R
 
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 pointersDr. Loganathan R
 
Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.Dr. Loganathan R
 
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-3Dr. Loganathan R
 
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-2Dr. Loganathan R
 
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-3Dr. Loganathan R
 
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-2Dr. Loganathan R
 
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-3Dr. Loganathan R
 
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-2Dr. Loganathan R
 
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-1Dr. Loganathan R
 
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-3Dr. Loganathan R
 
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-2Dr. Loganathan R
 
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-1Dr. Loganathan R
 
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-4Dr. Loganathan R
 
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-3Dr. Loganathan R
 
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-2Dr. Loganathan R
 
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-1Dr. Loganathan R
 
Introduction to Information Security
Introduction to Information SecurityIntroduction to Information Security
Introduction to Information SecurityDr. Loganathan R
 

Más 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