SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Part III
  Storage Management
Chapter 10: File-System Interface
Files
qA file is a named collection of related information
 that is recorded on secondary storage.
qThe operating systems maps this logical storage
 unit to the physical view of information storage.
qA file may have the following characteristics
  vFile Attributes
  vFile Operations
  vFile Types
  vFile Structures
  vInternal Files
File Attributes
qFile Name: The symbolic name is perhaps the only
 human readable file attribute.
qIdentifier: A unique number assigned to each file
 for identification purpose.
qFile Type: Some systems recognize various file
 types. Windows is a good example.
qFile Location: A pointer to a device to find a file.
qFile Size: The current size of a file, or the
 maximum allowed size.
qFile Protection: This is for access-control.
qFile Date, Time, Owner, etc.
File Operations: 1/2
qA file can be considered as an abstract data type
 that has data and accompanying operations.
qCreating a file
qWriting a file
qReading a file
qRepositioning within a file
qDeleting a file
qTruncating a file
qOther operations (e.g., appending a file, renaming a
 file)
File Operations: 2/2
                                                        disk

         system-wide                    process
         open-file table              open-file table     file

file index

                                        file pointer
                                      file open count
                           one file    disk location
                                       access right
File Structure
qSome systems support specific file types that
 have special file structures.
qFor example, files that contain binary
 executables.
qAn operating system becomes more complex
 when more file types (i.e., file structures) are
 supported.
qIn general, the number of supported file types
 is kept to minimum.
File Access Methods
qAccess method: how a file be used.
qThere are three popular ones:
 vSequential access method for sequential files
 vDirect access method for direct files
 vIndexed access method for indexed files.
Sequential Access Method
 qWith the sequential access method, the file is
  processed in order, one record after the other.
 qIf p is the file pointer, the next record to be
  accessed is either p+1 or p-1 (i.e., backspace).

                     current record

beginning                                                end of file
                                  next record




            rewind
                                            read/write
Direct Access Method
qA file is made up of fixed-length logical records.
qThe direct access method uses record number to
 identify each record. For example, read rec 0, write
 rec 100, seek rec 75, etc.
qSome systems may use a key field to access a record
 (e.g., read rec “Age=24” or write rec “Name=Dow”).
 This is usually achieved using hashing.
qSince records can be accessed in random order,
 direct access is also referred to as random access.
qDirect access method can simulate sequential access.
Indexed Access Method
qWith the indexed access method, a file is sorted in
 ascending order based on a number of keys.
qEach disk block may contain a number of fixed-
 length logical records.
qAn index table stores the keys of the first block in
 each block.
qWe can search the index table to locate the block
 that contains the desired record. Then, search the
 block to find the desired record.
qThis is exactly a one-level B-, B+ or B* tree.
qMulti-level index access method is also possible.
data file
        index table
last name logical rec #
Adams                      Ashcroft, … Asher, … Atkins
Arthur
Ashcroft


                          Smith, …. Sweeny, … Swell, …

Smith




index table is stored
In physical memory
Directory Structure: 1/2
qA large volume disk may be partitioned into
 partitions, or mini disks, or volumes.
qEach partition contains information about files
 within it. This information is stored in entries of a
 device directory or volume table of content (VTOC).
qThe device directory, or directory for short, stores
 the name, location, size, type, access method, etc of
 each file.
qOperations perform on directory: search for a file,
 create a file, delete a file, rename a file, traverse the
 file system, etc.
Directory Structure: 2/2
qThere are five commonly used directory
 structures:
  vSingle-Level Directory
  vTwo-Level Directory
  vTree-Structure Directories
  vAcyclic-Graph Directories
  vGeneral Graph Directories
Single-Level Directory
qAll files are contained in the same directory.
qIt is difficult to maintain file name uniqueness.
qCP/M-80 and early version of MS-DOS use this
 directory structure.
Two-Level Directory: 1/2
qThis is an extension of the single-level directory for
 multi-user system.
qEach user has his/her user file directory. The
 system’s master file directory is searched for the user
 directory when a user job starts.
qEarly CP/M-80 multi-user systems use this structure.
Two-Level Directory: 2/2
qTo locate a file, path name is used. For example,
 /user2/bo is the file bo of user 2.
qDifferent systems use different path names. For
 example, under MS-DOS it may be C:user2bo.
qThe directory of a special user, say user 0, may
 contain all system files.
Tree-Structured Directory
qEach directory or subdirectory contains files and
 subdirectories, and forms a tree.
qDirectories are special files.




                          /bin/mail/prog/spell
Acyclic-Graph Directory: 1/2
                                   qThis type of directories
                                    allows a file/directory to
                                    be shared by multiple
                                    directories.
                                   qThis is different from
                                    two copies of the same
                                    file or directory.
                                   qAn acyclic-graph
                                    directory is more
                                    flexible than a simple
file count is shared by directories tree structure.
dict and spell                      However, it is more
                                    complex.
Acyclic-Graph Directory: 2/2
qSince a file have multiple absolute path names, how do
 we calculate file system statistics or do backup?
 Would the same file be duplicated multiple times?
qHow do we delete a file?
  vIf sharing is implemented with symbolic links, we
    only delete the link if we have a list of links to the
    file. The file is removed when the list is empty.
  vOr, we remove the file and keep the links. When the
    file is accessed again, a message is given and the link
    is removed.
  vOr, we can maintain a reference count for each
    shared file. The file is removed when the count is
    zero.
General Graph Directory: 1/2
qIt is easy to traverse the directories of a tree or an
 acyclic directory system.
qHowever, if links are added arbitrarily, the directory
 graph becomes arbitrary and may contain cycles.
qHow do we search for a file?




     a cycle
General Graph Directory: 2/2
qHow do we delete a file? We can use reference count!
  vIn a cycle, due to self-reference, the reference
   count may be non-zero even when it is no longer
   possible to refer to a file or directory.
  vThus, garbage collection may needed. A garbage
   collector traverses the directory and marks files
   and directories that can be accessed.
  vA second round removes those inaccessible items.
qTo avoid this time-consuming task, a system can
 check if a cycle may occur when a link is made.
 How? You should know!
File Sharing

qWhen a file is shared by multiple users, how
 can we ensure its consistency?
qIf multiple users are writing to the file, should
 all of the writers be allowed to write?
qOr, should the operating system protect the
 user actions from each other?
qThis is the file consistency semantics.
File Consistency Semantics
qConsistency semantics is a characterization of
 the system that specifies the semantics of
 multiple users accessing a shared file
 simultaneously.
qConsistency semantics is an important criterion
 for evaluating any file system that supports file
 sharing.
qThere are three commonly used semantics
  vUnix semantics
  vSession Semantics
  vImmutable-Shared-Files Semantics
qA file session consists all file access between
 open() and close().
Unix Semantics
qWrites to an open file by a user are visible
 immediately to other users have the file open at
 the same time.
qAll users share the file pointer. Thus, advancing
 the file pointer by one user affects all sharing
 users.
qA file has a single image that interleaves all
 accesses, regardless of their origin.
Session Semantics
qWrites to an open file by a user are not visible
 immediately to other users that have the same file
 open simultaneously.
qOnce a file is closed, the changes made to it are visible
 only in sessions started later.
qAlready-open instances of the file do not affect these
 changes.
  vA file may be associated temporarily with several
   and possible different images at the same time.
  vMultiple users are allowed to perform both read
   and write concurrently on their image of the file
   without delay.
qThe Andrew File System (AFS) uses this semantics.
Immutable-Shared-Files Semantics
 qOnce a file is declared as shared by its creator, it
  cannot be modified.
 qAn immutable file has two important properties:
   vIts name may not be used
   vIts content may not be altered
 qThus, the name of an immutable file indicates that
  the contents of the file is fixed – a constant rather
  than a variable.
 qThe implementation of these semantics in a
  distributed system is simple, since sharing is
  disciplined (i.e., read-only).
File Protection

qWe can keep files safe from physical damage (i.e.,
 reliability) and improper access (i.e., protection).
qReliability is generally provided by backup.
qThe need for file protection is a direct result of the
 ability to access files.
qAccess control may be a complete protection by
 denying access. Or, the access may be controlled.
File Protection: Types of Access
 qAccess control may be implemented by limiting
  the types of file access that can be made.
 qThe types of access may be
   vRead: read from the file
   vWrite: write or rewrite the file
   vExecute: load the file into memory and
     execute it
   vAppend: write new info at the end of a file
   vDelete: delete a file
   vList: list the name and attributes of the file
File Protection: Access Control: 1/4
  qThe most commonly used approach is to make
   the access dependent on the identity of the user.
  qEach file and directory is associated with an
   access matrix specifying the user name and the
   types of permitted access.
  qWhen a user makes a request to access a file or
   a directory, his/her identity is compared
   against the information stored in the access
   matrix.
File Protection: Access Control: 2/4
                       Access Matrix

          File 1 File 2 File 3 File 4   Account 1 Account 2

          Own            Own            Inquiry
 User A    R              R              Credit
           W              W
                 Own                    Inquiry Inquiry
 User B    R      R              R       debit   Credit
                  W       W
                                Own               Inquiry
 User C    R       R             R                 debit
           W                     W
File Protection: Access Control: 3/4
          A     B    C
File 1   Own
          R
          W
               R     R
                     W     Access-control Lists
File 2
          B
         Own
               C
                         qIn practice, the access
          R
          W
               R
                          matrix is sparse.
                         qThe matrix can be
          A     B
File 3   Own              decomposed into
          R
          W    W          columns (files), yielding
                          access-control lists (ACL)
File 4
          B     C        qHowever, this list can be
               Own
         R      R         very long!
                W
File Protection: Access Control: 4/4
         File 1   File 3
User A   Own      Own         Capability Lists
           R        R
          W        W



User B
         File 1   File 2
                  Own
                           File 3   File 4
                                             qDecomposition
           R
                   W
                    R
                             W
                                      R
                                              by rows (users)
                                              yields capability
         File 1   File 2   File 4
                                              tickets.
User C
          R         R
                           Own
                             R               qEach user has a
          W                 W
                                              number ticket
                                              for file/directory
                                              access.

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

operating system structure
operating system structureoperating system structure
operating system structure
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
Shell programming
Shell programmingShell programming
Shell programming
 
HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML forms
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFS
 
Memory management
Memory managementMemory management
Memory management
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
 
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
 
Computer Organization and Architecture.pdf
Computer Organization and Architecture.pdfComputer Organization and Architecture.pdf
Computer Organization and Architecture.pdf
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
 
Network programming
Network programmingNetwork programming
Network programming
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Apache ppt
Apache pptApache ppt
Apache ppt
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Reader/writer problem
Reader/writer problemReader/writer problem
Reader/writer problem
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Memory management
Memory managementMemory management
Memory management
 

Semelhante a File system

File systeminterface-pre-final-formatting
File systeminterface-pre-final-formattingFile systeminterface-pre-final-formatting
File systeminterface-pre-final-formattingmarangburu42
 
File system interface Pre Final
File system interface Pre FinalFile system interface Pre Final
File system interface Pre Finalmarangburu42
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.pptHelalMirzad
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinalmarangburu42
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System InterfaceWayne Jones Jnr
 
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 Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasFile Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasPrabu U
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file managementKalai Selvi
 
3. distributed file system requirements
3. distributed file system requirements3. distributed file system requirements
3. distributed file system requirementsAbDul ThaYyal
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systemsdonny101
 
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 .
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.pptMeesanRaza
 

Semelhante a File system (20)

Os6
Os6Os6
Os6
 
File systeminterface-pre-final-formatting
File systeminterface-pre-final-formattingFile systeminterface-pre-final-formatting
File systeminterface-pre-final-formatting
 
File system interface Pre Final
File system interface Pre FinalFile system interface Pre Final
File system interface Pre Final
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.ppt
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
File Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with PandasFile Input/output, Database Access, Data Analysis with Pandas
File Input/output, Database Access, Data Analysis with Pandas
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file management
 
3. distributed file system requirements
3. distributed file system requirements3. distributed file system requirements
3. distributed file system requirements
 
File System operating system operating system
File System  operating system operating systemFile System  operating system operating system
File System operating system operating system
 
File system
File systemFile system
File system
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
Files
FilesFiles
Files
 
Licão 04 permissions
Licão 04 permissionsLicão 04 permissions
Licão 04 permissions
 
File Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.SivakumarFile Directory Structure-R.D.Sivakumar
File Directory Structure-R.D.Sivakumar
 
5263802.ppt
5263802.ppt5263802.ppt
5263802.ppt
 
CH11.pdf
CH11.pdfCH11.pdf
CH11.pdf
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 

Mais de Mohd Arif

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcpMohd Arif
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarpMohd Arif
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolMohd Arif
 
Project identification
Project identificationProject identification
Project identificationMohd Arif
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniquesMohd Arif
 
Presentation
PresentationPresentation
PresentationMohd Arif
 
Pointers in c
Pointers in cPointers in c
Pointers in cMohd Arif
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peerMohd Arif
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systemsMohd Arif
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdpMohd Arif
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgetingMohd Arif
 
Network management
Network managementNetwork management
Network managementMohd Arif
 
Networing basics
Networing basicsNetworing basics
Networing basicsMohd Arif
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformMohd Arif
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and sslMohd Arif
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psecMohd Arif
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardwareMohd Arif
 

Mais de Mohd Arif (20)

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcp
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
Project identification
Project identificationProject identification
Project identification
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniques
 
Presentation
PresentationPresentation
Presentation
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peer
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systems
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgeting
 
Network management
Network managementNetwork management
Network management
 
Networing basics
Networing basicsNetworing basics
Networing basics
 
Loaders
LoadersLoaders
Loaders
 
Lists
ListsLists
Lists
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platform
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psec
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardware
 
Heap sort
Heap sortHeap sort
Heap sort
 

Último

URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Último (20)

URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

File system

  • 1. Part III Storage Management Chapter 10: File-System Interface
  • 2. Files qA file is a named collection of related information that is recorded on secondary storage. qThe operating systems maps this logical storage unit to the physical view of information storage. qA file may have the following characteristics vFile Attributes vFile Operations vFile Types vFile Structures vInternal Files
  • 3. File Attributes qFile Name: The symbolic name is perhaps the only human readable file attribute. qIdentifier: A unique number assigned to each file for identification purpose. qFile Type: Some systems recognize various file types. Windows is a good example. qFile Location: A pointer to a device to find a file. qFile Size: The current size of a file, or the maximum allowed size. qFile Protection: This is for access-control. qFile Date, Time, Owner, etc.
  • 4. File Operations: 1/2 qA file can be considered as an abstract data type that has data and accompanying operations. qCreating a file qWriting a file qReading a file qRepositioning within a file qDeleting a file qTruncating a file qOther operations (e.g., appending a file, renaming a file)
  • 5. File Operations: 2/2 disk system-wide process open-file table open-file table file file index file pointer file open count one file disk location access right
  • 6. File Structure qSome systems support specific file types that have special file structures. qFor example, files that contain binary executables. qAn operating system becomes more complex when more file types (i.e., file structures) are supported. qIn general, the number of supported file types is kept to minimum.
  • 7. File Access Methods qAccess method: how a file be used. qThere are three popular ones: vSequential access method for sequential files vDirect access method for direct files vIndexed access method for indexed files.
  • 8. Sequential Access Method qWith the sequential access method, the file is processed in order, one record after the other. qIf p is the file pointer, the next record to be accessed is either p+1 or p-1 (i.e., backspace). current record beginning end of file next record rewind read/write
  • 9. Direct Access Method qA file is made up of fixed-length logical records. qThe direct access method uses record number to identify each record. For example, read rec 0, write rec 100, seek rec 75, etc. qSome systems may use a key field to access a record (e.g., read rec “Age=24” or write rec “Name=Dow”). This is usually achieved using hashing. qSince records can be accessed in random order, direct access is also referred to as random access. qDirect access method can simulate sequential access.
  • 10. Indexed Access Method qWith the indexed access method, a file is sorted in ascending order based on a number of keys. qEach disk block may contain a number of fixed- length logical records. qAn index table stores the keys of the first block in each block. qWe can search the index table to locate the block that contains the desired record. Then, search the block to find the desired record. qThis is exactly a one-level B-, B+ or B* tree. qMulti-level index access method is also possible.
  • 11. data file index table last name logical rec # Adams Ashcroft, … Asher, … Atkins Arthur Ashcroft Smith, …. Sweeny, … Swell, … Smith index table is stored In physical memory
  • 12. Directory Structure: 1/2 qA large volume disk may be partitioned into partitions, or mini disks, or volumes. qEach partition contains information about files within it. This information is stored in entries of a device directory or volume table of content (VTOC). qThe device directory, or directory for short, stores the name, location, size, type, access method, etc of each file. qOperations perform on directory: search for a file, create a file, delete a file, rename a file, traverse the file system, etc.
  • 13. Directory Structure: 2/2 qThere are five commonly used directory structures: vSingle-Level Directory vTwo-Level Directory vTree-Structure Directories vAcyclic-Graph Directories vGeneral Graph Directories
  • 14. Single-Level Directory qAll files are contained in the same directory. qIt is difficult to maintain file name uniqueness. qCP/M-80 and early version of MS-DOS use this directory structure.
  • 15. Two-Level Directory: 1/2 qThis is an extension of the single-level directory for multi-user system. qEach user has his/her user file directory. The system’s master file directory is searched for the user directory when a user job starts. qEarly CP/M-80 multi-user systems use this structure.
  • 16. Two-Level Directory: 2/2 qTo locate a file, path name is used. For example, /user2/bo is the file bo of user 2. qDifferent systems use different path names. For example, under MS-DOS it may be C:user2bo. qThe directory of a special user, say user 0, may contain all system files.
  • 17. Tree-Structured Directory qEach directory or subdirectory contains files and subdirectories, and forms a tree. qDirectories are special files. /bin/mail/prog/spell
  • 18. Acyclic-Graph Directory: 1/2 qThis type of directories allows a file/directory to be shared by multiple directories. qThis is different from two copies of the same file or directory. qAn acyclic-graph directory is more flexible than a simple file count is shared by directories tree structure. dict and spell However, it is more complex.
  • 19. Acyclic-Graph Directory: 2/2 qSince a file have multiple absolute path names, how do we calculate file system statistics or do backup? Would the same file be duplicated multiple times? qHow do we delete a file? vIf sharing is implemented with symbolic links, we only delete the link if we have a list of links to the file. The file is removed when the list is empty. vOr, we remove the file and keep the links. When the file is accessed again, a message is given and the link is removed. vOr, we can maintain a reference count for each shared file. The file is removed when the count is zero.
  • 20. General Graph Directory: 1/2 qIt is easy to traverse the directories of a tree or an acyclic directory system. qHowever, if links are added arbitrarily, the directory graph becomes arbitrary and may contain cycles. qHow do we search for a file? a cycle
  • 21. General Graph Directory: 2/2 qHow do we delete a file? We can use reference count! vIn a cycle, due to self-reference, the reference count may be non-zero even when it is no longer possible to refer to a file or directory. vThus, garbage collection may needed. A garbage collector traverses the directory and marks files and directories that can be accessed. vA second round removes those inaccessible items. qTo avoid this time-consuming task, a system can check if a cycle may occur when a link is made. How? You should know!
  • 22. File Sharing qWhen a file is shared by multiple users, how can we ensure its consistency? qIf multiple users are writing to the file, should all of the writers be allowed to write? qOr, should the operating system protect the user actions from each other? qThis is the file consistency semantics.
  • 23. File Consistency Semantics qConsistency semantics is a characterization of the system that specifies the semantics of multiple users accessing a shared file simultaneously. qConsistency semantics is an important criterion for evaluating any file system that supports file sharing. qThere are three commonly used semantics vUnix semantics vSession Semantics vImmutable-Shared-Files Semantics qA file session consists all file access between open() and close().
  • 24. Unix Semantics qWrites to an open file by a user are visible immediately to other users have the file open at the same time. qAll users share the file pointer. Thus, advancing the file pointer by one user affects all sharing users. qA file has a single image that interleaves all accesses, regardless of their origin.
  • 25. Session Semantics qWrites to an open file by a user are not visible immediately to other users that have the same file open simultaneously. qOnce a file is closed, the changes made to it are visible only in sessions started later. qAlready-open instances of the file do not affect these changes. vA file may be associated temporarily with several and possible different images at the same time. vMultiple users are allowed to perform both read and write concurrently on their image of the file without delay. qThe Andrew File System (AFS) uses this semantics.
  • 26. Immutable-Shared-Files Semantics qOnce a file is declared as shared by its creator, it cannot be modified. qAn immutable file has two important properties: vIts name may not be used vIts content may not be altered qThus, the name of an immutable file indicates that the contents of the file is fixed – a constant rather than a variable. qThe implementation of these semantics in a distributed system is simple, since sharing is disciplined (i.e., read-only).
  • 27. File Protection qWe can keep files safe from physical damage (i.e., reliability) and improper access (i.e., protection). qReliability is generally provided by backup. qThe need for file protection is a direct result of the ability to access files. qAccess control may be a complete protection by denying access. Or, the access may be controlled.
  • 28. File Protection: Types of Access qAccess control may be implemented by limiting the types of file access that can be made. qThe types of access may be vRead: read from the file vWrite: write or rewrite the file vExecute: load the file into memory and execute it vAppend: write new info at the end of a file vDelete: delete a file vList: list the name and attributes of the file
  • 29. File Protection: Access Control: 1/4 qThe most commonly used approach is to make the access dependent on the identity of the user. qEach file and directory is associated with an access matrix specifying the user name and the types of permitted access. qWhen a user makes a request to access a file or a directory, his/her identity is compared against the information stored in the access matrix.
  • 30. File Protection: Access Control: 2/4 Access Matrix File 1 File 2 File 3 File 4 Account 1 Account 2 Own Own Inquiry User A R R Credit W W Own Inquiry Inquiry User B R R R debit Credit W W Own Inquiry User C R R R debit W W
  • 31. File Protection: Access Control: 3/4 A B C File 1 Own R W R R W Access-control Lists File 2 B Own C qIn practice, the access R W R matrix is sparse. qThe matrix can be A B File 3 Own decomposed into R W W columns (files), yielding access-control lists (ACL) File 4 B C qHowever, this list can be Own R R very long! W
  • 32. File Protection: Access Control: 4/4 File 1 File 3 User A Own Own Capability Lists R R W W User B File 1 File 2 Own File 3 File 4 qDecomposition R W R W R by rows (users) yields capability File 1 File 2 File 4 tickets. User C R R Own R qEach user has a W W number ticket for file/directory access.