SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Part III
    Storage Management
Chapter 11: File System Implementation
Layered
File System
Overview: 1/4
qA file system has on-disk and in-memory
 information.
qA disk may contain the following for
 implementing a file system on it:
  vA boot control block per volume
  vA partition control block per volume
  vA directory structure per file system
  vA file control block per file
qIn-memory information include
  vAn in-memory partition table
  vAn in-memory directory structure
  vThe system-wide open-file table
  vThe per-process open-file table
Overview: 2/4
a typical file control block FCB   qA FCB, file control
                                    block, contains the
 file permission                    details of a file.
 file date                         qIn Unix, a FCB is
 file owner, group, ACL
                                    called an i-node.

 file size

 file data blocks
Overview: 3/4               3: read the directory
     4: update FCB and directory
                         kernel memory                 disk memory
   user program




  open(filename)                                      directory structure
                             directory structure



1: create a new file
                                                            FCB
 5: a file descriptor/file handle
   is returned
                                    2: allocate a new FCB
Overview: 4/4
        index
                   kernel memory       disk memory
user program         per-process
                     open-file table



                                        Data blocks

read(index)          system-wide
                     open-file table




                                          FCB
Directory Implementation
qA File directory is usually implemented as a
 linked-list or a tree (e.g., B-tree), a hash table
 with chaining, or the combination of both.
qThe problem with the linked-list approach is
 the poor performance in searching for a file.
 Directory search is a very frequently
 performed operation.
qThe hash table approach speeds up search;
 however, we must deal with the problem of
 collisions. Thus, chaining is necessary.
Directory Entries: 1/2
qA directory is simply a file!
qA directory entry may be very simple like the
 one used by MS-DOS. Or, it may be quite
 complex like the Unix i-node.




  extended MS-DOS directory entry used in Windows 98
Directory Entries: 2/2

Unix directory entry
                       find /usr/ast/mbox
File Allocation Methods

qThere are three typical file space allocation
 methods:
 vContiguous Allocation
 vLinked Allocation
 vIndexed Allocation
Contiguous Allocation: 1/3
qWith the contiguous allocation method, a user
 must indicate the file size before creating the file.
qThen, the operating system searches the disk to
 find contiguous disk blocks for the file.
qThe directory entry is easy. It contains the initial
 disk address of this file and the number of disk
 blocks.
qTherefore, if the initial address is b and the
 number of blocks is n, the file will occupy blocks b,
 b+1, b+2, …, b+n-1.
Contiguous Allocation: 2/3

                         directory




               Since blocks are allocated
               contiguously, external
               fragmentation may occur.
               Thus, compaction may be
               needed.
Contiguous Allocation: 3/3
qContiguous allocation is easy to implement.
qIts disadvantages are
  vIt can be considered as a form of dynamic
    memory allocation, and external fragmentation
    may occur and compaction may be needed.
  vIt is difficult to estimate the file size. The size of
    a file may grow at run time and may be larger
    than the specified number of allocated blocks.
    In this case, the OS must move the blocks in
    order to provide mode space. In some systems,
    this is simply an error.
Linked Allocation: 1/3
qWith the linked allocation approach, disk
 blocks of a file are chained together with a
 linked-list.
qThe directory entry of a file contains a pointer
 to the first block and a pointer to the last block.
qTo create a file, we create a new directory entry
 and the pointers are initialized to nil.
qWhen a write occurs, a new disk block is
 allocated and chained to the end of the list.
Linked Allocation: 2/3
            directory

                        28   Last Block




      qFile blocks are chained into a
       linked-list.
      qThe directory entry has pointers
       to the first and last file blocks.
      qAppend is difficult to do without
       the last pointer.
Linked Allocation: 3/3
qAdvantages:
 vFile size does not have to be specified.
 vNo external fragmentation.
qDisadvantages:
 vIt does sequential access efficiently and is not
   for direct access
 vEach block contains a pointer, wasting space
 vBlocks scatter everywhere and a large number
   of disk seeks may be necessary
 vReliability: what if a pointer is lost or damaged?
File Allocation Table (FAT)
                          FAT
                    0                 q This is a variation of the
                                        linked allocation by
                                        pulling all pointers into a
                  217      618          table, the file allocation
directory                               table (FAT).
   test                               q Large no. of disk seeks.
                  339   end-of-file
                                      q Can do direct access.
                                      q FAT needs space.
   217                                q The left diagram shows
                  618      339          file test has its first
                                        block at 217, followed by
                                        618, 339 (end of file).
      no. of blocks-1                 q What if FAT is damaged?
                                        We all know it well!
Indexed Allocation: 1/4
qEach file has an index block that is an array of
 disk block addresses.
qThe i-th entry in the index block points to the i-th
 block of the file.
qA file’s directory entry contains a pointer to its
 index. Hence, the index block of an indexed
 allocation plays the same role as the page table.
qIndex allocation supports both sequential and
 direct access without external fragmentation.
Indexed Allocation: 2/4

                   directory




             index block
Indexed Allocation: 3/4
qThe indexed allocation suffers from wasted space.
 The index block may not be fully used (i.e., internal
 fragmentation).
qThe number of entries of an index table determines
 the size of a file. To overcome this problem, we can
  vHave multiple index blocks and chain them into
    a linked-list
  vHave multiple index blocks, but make them a
    tree just like the indexed access method
  vA combination of both
Indexed Allocation: 4/4

 i-node
  10 direct blocks




256 entries per index table.
What is the maximum size of a file?
Free Space Management
qHow do we keep track free blocks on a disk?
qA free-list is maintained. When a new block is
 requested, we search this list to find one.
qThe following are commonly used techniques:
  vBit Vector
  vLinked List
  vLinked List + Grouping
  vLinked List+Address+Count
Bit Vector
qEach block is represented by a bit in a table. Thus,
 if there are n disk blocks, the table has n bits.
qIf a block is free, its corresponding bit is 1.
qWhen a block is needed, the table is searched. If a 1
 bit is found in position k, block k is free.
qIf the disk capacity is small, the whole bit vector can
 be stored in memory. For a large disk, this bit
 vector will consume too much memory.
qWe could group a few blocks into a cluster and
 allocate clusters. This saves space and may cause
 internal fragmentation.
qAnother possibility is the use of a summary table.
Linked List
qLike the linked allocation method, free blocks can
 be chained into a linked list.
qWhen a free block is needed, the first in the chain is
 allocated.
qHowever, this method has the same disadvantages
 of the linked allocation method.
qWe can use a FAT for the disk and chain the free
 block pointers together. Keep in mind that the
 FAT may be very large and consume space if it is
 stored in memory.
Grouping
qThe first free block contains the addresses of n
 other free blocks.
qFor each group, the first n-1 blocks are actually
 free and the last (i.e., n-th) block contains the
 addresses of the next group.
qIn this way, we can quickly locate free blocks.

    3     8 50        3                         6
   (3 & 8 are free)
      8
                            12

           20
                                                50
                            (6 & 12 are free)   6 12 20
Address + Counting
qWe can make the list short with the following trick:
 vBlocks are often allocated and freed in groups
 vWe can store the address of the first free block
  and the number of the following n free blocks.


  free block list



             5


             3
                                      disk

Mais conteúdo relacionado

Mais procurados

Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System ImplementationWayne Jones Jnr
 
Chomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsChomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsRajendran
 
File system Os
File system OsFile system Os
File system OsNehal Naik
 
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 NFSUnited International University
 
File Management
File ManagementFile Management
File Managementspickul
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system conceptsStarlee Lathong
 
File Protection in Operating System
File Protection in Operating SystemFile Protection in Operating System
File Protection in Operating SystemMeghaj Mallick
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access methodrajshreemuthiah
 
File system.
File system.File system.
File system.elyza12
 
Cs6503 theory of computation book notes
Cs6503 theory of computation book notesCs6503 theory of computation book notes
Cs6503 theory of computation book notesappasami
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System InterfaceWayne Jones Jnr
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsWayne Jones Jnr
 
Disk allocation methods
Disk allocation methodsDisk allocation methods
Disk allocation methodsajeela mushtaq
 

Mais procurados (20)

File system
File systemFile system
File system
 
NTFS vs FAT
NTFS vs FATNTFS vs FAT
NTFS vs FAT
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
Chomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsChomsky & Greibach Normal Forms
Chomsky & Greibach Normal Forms
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
File system Os
File system OsFile system Os
File system Os
 
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
 
File Management
File ManagementFile Management
File Management
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system concepts
 
File Protection in Operating System
File Protection in Operating SystemFile Protection in Operating System
File Protection in Operating System
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
File system.
File system.File system.
File system.
 
Cs6503 theory of computation book notes
Cs6503 theory of computation book notesCs6503 theory of computation book notes
Cs6503 theory of computation book notes
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
File system structure
File system structureFile system structure
File system structure
 
File access method
File access methodFile access method
File access method
 
Disk allocation methods
Disk allocation methodsDisk allocation methods
Disk allocation methods
 

Destaque

Htcia an introduction to the microsoft ex fat file system 1.01 final
Htcia   an introduction to the microsoft ex fat file system 1.01 finalHtcia   an introduction to the microsoft ex fat file system 1.01 final
Htcia an introduction to the microsoft ex fat file system 1.01 finalovercertified
 
File management ppt
File management pptFile management ppt
File management pptmarotti
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File ManagementDamian T. Gordon
 
Ch11: File System Interface
Ch11: File System InterfaceCh11: File System Interface
Ch11: File System InterfaceAhmar Hashmi
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating SystemsJohn Cutajar
 
Deepak's green computing
Deepak's green computingDeepak's green computing
Deepak's green computingDeepak Sharma
 
Linked allocation 48
Linked  allocation 48Linked  allocation 48
Linked allocation 48myrajendra
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tablesshashikant pabari
 
Overview of System Virtualization
Overview of System VirtualizationOverview of System Virtualization
Overview of System VirtualizationAndre Odendaal
 
File management
File managementFile management
File managementMohd Arif
 

Destaque (12)

Htcia an introduction to the microsoft ex fat file system 1.01 final
Htcia   an introduction to the microsoft ex fat file system 1.01 finalHtcia   an introduction to the microsoft ex fat file system 1.01 final
Htcia an introduction to the microsoft ex fat file system 1.01 final
 
File management
File managementFile management
File management
 
File management ppt
File management pptFile management ppt
File management ppt
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File Management
 
Ch11: File System Interface
Ch11: File System InterfaceCh11: File System Interface
Ch11: File System Interface
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating Systems
 
Deepak's green computing
Deepak's green computingDeepak's green computing
Deepak's green computing
 
Linked allocation 48
Linked  allocation 48Linked  allocation 48
Linked allocation 48
 
File System and File allocation tables
File System and File allocation tablesFile System and File allocation tables
File System and File allocation tables
 
Overview of System Virtualization
Overview of System VirtualizationOverview of System Virtualization
Overview of System Virtualization
 
File management
File managementFile management
File management
 
File system
File systemFile system
File system
 

Semelhante a File implementation

File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptxRajapriya82
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingZainab Almugbel
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OSC.U
 
Query processing and optimization
Query processing and optimizationQuery processing and optimization
Query processing and optimizationArif A.
 
6 chapter 6 record storage and primary file organization
6 chapter 6  record storage and primary file organization6 chapter 6  record storage and primary file organization
6 chapter 6 record storage and primary file organizationsiragezeynu
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.pptHelalMirzad
 
OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)Chinmaya M. N
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space managementrajshreemuthiah
 
File Access & File System & File Allocation Table
File Access & File System & File Allocation TableFile Access & File System & File Allocation Table
File Access & File System & File Allocation TableChinmaya M. N
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potxVlad Lesin
 

Semelhante a File implementation (20)

File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptx
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashing
 
Chapter13
Chapter13Chapter13
Chapter13
 
Ch11
Ch11Ch11
Ch11
 
OSCh12
OSCh12OSCh12
OSCh12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
Query processing and optimization
Query processing and optimizationQuery processing and optimization
Query processing and optimization
 
File Allocation Methods.ppt
File Allocation Methods.pptFile Allocation Methods.ppt
File Allocation Methods.ppt
 
6 chapter 6 record storage and primary file organization
6 chapter 6  record storage and primary file organization6 chapter 6  record storage and primary file organization
6 chapter 6 record storage and primary file organization
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
 
OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)OS_Assignment for Disk Space & File System & File allocation table(FAT)
OS_Assignment for Disk Space & File System & File allocation table(FAT)
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
 
Updates
UpdatesUpdates
Updates
 
Updates
UpdatesUpdates
Updates
 
File Access & File System & File Allocation Table
File Access & File System & File Allocation TableFile Access & File System & File Allocation Table
File Access & File System & File Allocation Table
 
File Management.ppt
File Management.pptFile Management.ppt
File Management.ppt
 
Ch12_OS_Lecture 5.pdf
Ch12_OS_Lecture 5.pdfCh12_OS_Lecture 5.pdf
Ch12_OS_Lecture 5.pdf
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potx
 

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

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
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
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
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
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Último (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
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
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

File implementation

  • 1. Part III Storage Management Chapter 11: File System Implementation
  • 3. Overview: 1/4 qA file system has on-disk and in-memory information. qA disk may contain the following for implementing a file system on it: vA boot control block per volume vA partition control block per volume vA directory structure per file system vA file control block per file qIn-memory information include vAn in-memory partition table vAn in-memory directory structure vThe system-wide open-file table vThe per-process open-file table
  • 4. Overview: 2/4 a typical file control block FCB qA FCB, file control block, contains the file permission details of a file. file date qIn Unix, a FCB is file owner, group, ACL called an i-node. file size file data blocks
  • 5. Overview: 3/4 3: read the directory 4: update FCB and directory kernel memory disk memory user program open(filename) directory structure directory structure 1: create a new file FCB 5: a file descriptor/file handle is returned 2: allocate a new FCB
  • 6. Overview: 4/4 index kernel memory disk memory user program per-process open-file table Data blocks read(index) system-wide open-file table FCB
  • 7. Directory Implementation qA File directory is usually implemented as a linked-list or a tree (e.g., B-tree), a hash table with chaining, or the combination of both. qThe problem with the linked-list approach is the poor performance in searching for a file. Directory search is a very frequently performed operation. qThe hash table approach speeds up search; however, we must deal with the problem of collisions. Thus, chaining is necessary.
  • 8. Directory Entries: 1/2 qA directory is simply a file! qA directory entry may be very simple like the one used by MS-DOS. Or, it may be quite complex like the Unix i-node. extended MS-DOS directory entry used in Windows 98
  • 9. Directory Entries: 2/2 Unix directory entry find /usr/ast/mbox
  • 10. File Allocation Methods qThere are three typical file space allocation methods: vContiguous Allocation vLinked Allocation vIndexed Allocation
  • 11. Contiguous Allocation: 1/3 qWith the contiguous allocation method, a user must indicate the file size before creating the file. qThen, the operating system searches the disk to find contiguous disk blocks for the file. qThe directory entry is easy. It contains the initial disk address of this file and the number of disk blocks. qTherefore, if the initial address is b and the number of blocks is n, the file will occupy blocks b, b+1, b+2, …, b+n-1.
  • 12. Contiguous Allocation: 2/3 directory Since blocks are allocated contiguously, external fragmentation may occur. Thus, compaction may be needed.
  • 13. Contiguous Allocation: 3/3 qContiguous allocation is easy to implement. qIts disadvantages are vIt can be considered as a form of dynamic memory allocation, and external fragmentation may occur and compaction may be needed. vIt is difficult to estimate the file size. The size of a file may grow at run time and may be larger than the specified number of allocated blocks. In this case, the OS must move the blocks in order to provide mode space. In some systems, this is simply an error.
  • 14. Linked Allocation: 1/3 qWith the linked allocation approach, disk blocks of a file are chained together with a linked-list. qThe directory entry of a file contains a pointer to the first block and a pointer to the last block. qTo create a file, we create a new directory entry and the pointers are initialized to nil. qWhen a write occurs, a new disk block is allocated and chained to the end of the list.
  • 15. Linked Allocation: 2/3 directory 28 Last Block qFile blocks are chained into a linked-list. qThe directory entry has pointers to the first and last file blocks. qAppend is difficult to do without the last pointer.
  • 16. Linked Allocation: 3/3 qAdvantages: vFile size does not have to be specified. vNo external fragmentation. qDisadvantages: vIt does sequential access efficiently and is not for direct access vEach block contains a pointer, wasting space vBlocks scatter everywhere and a large number of disk seeks may be necessary vReliability: what if a pointer is lost or damaged?
  • 17. File Allocation Table (FAT) FAT 0 q This is a variation of the linked allocation by pulling all pointers into a 217 618 table, the file allocation directory table (FAT). test q Large no. of disk seeks. 339 end-of-file q Can do direct access. q FAT needs space. 217 q The left diagram shows 618 339 file test has its first block at 217, followed by 618, 339 (end of file). no. of blocks-1 q What if FAT is damaged? We all know it well!
  • 18. Indexed Allocation: 1/4 qEach file has an index block that is an array of disk block addresses. qThe i-th entry in the index block points to the i-th block of the file. qA file’s directory entry contains a pointer to its index. Hence, the index block of an indexed allocation plays the same role as the page table. qIndex allocation supports both sequential and direct access without external fragmentation.
  • 19. Indexed Allocation: 2/4 directory index block
  • 20. Indexed Allocation: 3/4 qThe indexed allocation suffers from wasted space. The index block may not be fully used (i.e., internal fragmentation). qThe number of entries of an index table determines the size of a file. To overcome this problem, we can vHave multiple index blocks and chain them into a linked-list vHave multiple index blocks, but make them a tree just like the indexed access method vA combination of both
  • 21. Indexed Allocation: 4/4 i-node 10 direct blocks 256 entries per index table. What is the maximum size of a file?
  • 22. Free Space Management qHow do we keep track free blocks on a disk? qA free-list is maintained. When a new block is requested, we search this list to find one. qThe following are commonly used techniques: vBit Vector vLinked List vLinked List + Grouping vLinked List+Address+Count
  • 23. Bit Vector qEach block is represented by a bit in a table. Thus, if there are n disk blocks, the table has n bits. qIf a block is free, its corresponding bit is 1. qWhen a block is needed, the table is searched. If a 1 bit is found in position k, block k is free. qIf the disk capacity is small, the whole bit vector can be stored in memory. For a large disk, this bit vector will consume too much memory. qWe could group a few blocks into a cluster and allocate clusters. This saves space and may cause internal fragmentation. qAnother possibility is the use of a summary table.
  • 24. Linked List qLike the linked allocation method, free blocks can be chained into a linked list. qWhen a free block is needed, the first in the chain is allocated. qHowever, this method has the same disadvantages of the linked allocation method. qWe can use a FAT for the disk and chain the free block pointers together. Keep in mind that the FAT may be very large and consume space if it is stored in memory.
  • 25. Grouping qThe first free block contains the addresses of n other free blocks. qFor each group, the first n-1 blocks are actually free and the last (i.e., n-th) block contains the addresses of the next group. qIn this way, we can quickly locate free blocks. 3 8 50 3 6 (3 & 8 are free) 8 12 20 50 (6 & 12 are free) 6 12 20
  • 26. Address + Counting qWe can make the list short with the following trick: vBlocks are often allocated and freed in groups vWe can store the address of the first free block and the number of the following n free blocks. free block list 5 3 disk