SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issuesEsar Qasmi
 
Directory implementation and allocation methods
Directory implementation and allocation methodsDirectory implementation and allocation methods
Directory implementation and allocation methodssangrampatil81
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systemsViet-Trung TRAN
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashingJeet Poria
 
similarity measure
similarity measure similarity measure
similarity measure ZHAO Sam
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseMd. Shamsur Rahim
 
Distributed file system
Distributed file systemDistributed file system
Distributed file systemAnamika Singh
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Computer Networking: Subnetting and IP Addressing
Computer Networking: Subnetting and IP AddressingComputer Networking: Subnetting and IP Addressing
Computer Networking: Subnetting and IP AddressingBisrat Girma
 
Deadlock management
Deadlock managementDeadlock management
Deadlock managementAhmed kasim
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 

Tendances (20)

Hashing
HashingHashing
Hashing
 
Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issues
 
Directory implementation and allocation methods
Directory implementation and allocation methodsDirectory implementation and allocation methods
Directory implementation and allocation methods
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systems
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
Extensible hashing
Extensible hashingExtensible hashing
Extensible hashing
 
Fragmentaton
Fragmentaton Fragmentaton
Fragmentaton
 
Distributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - IntroductionDistributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - Introduction
 
similarity measure
similarity measure similarity measure
similarity measure
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed Database
 
Lec 7 query processing
Lec 7 query processingLec 7 query processing
Lec 7 query processing
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Google File System
Google File SystemGoogle File System
Google File System
 
Ddbms1
Ddbms1Ddbms1
Ddbms1
 
Computer Networking: Subnetting and IP Addressing
Computer Networking: Subnetting and IP AddressingComputer Networking: Subnetting and IP Addressing
Computer Networking: Subnetting and IP Addressing
 
File system implementation
File system implementationFile system implementation
File system implementation
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
Data partitioning
Data partitioningData partitioning
Data partitioning
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 

En vedette

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
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System ImplementationWayne Jones Jnr
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 

En vedette (15)

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
 
File system
File systemFile system
File system
 
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
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
File system
File systemFile system
File system
 

Similaire à 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
 
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
 
Plam15 slides.potx
Plam15 slides.potxPlam15 slides.potx
Plam15 slides.potxVlad Lesin
 

Similaire à 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
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
OSCh12
OSCh12OSCh12
OSCh12
 
Query processing and optimization
Query processing and optimizationQuery processing and optimization
Query processing and optimization
 
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
 
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.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
 

Plus 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
 

Plus 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
 

Dernier

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Dernier (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

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