SlideShare a Scribd company logo
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

More Related Content

What's hot

Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
Disk structure
Disk structureDisk structure
Disk structure
Agnas Jasmine
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
rajshreemuthiah
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
Wayne Jones Jnr
 
Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
Abdullah Al Shiam
 
Operations on Processes
Operations on ProcessesOperations on Processes
Operations on Processes
Navid Daneshvaran
 
Free space managment46
Free space managment46Free space managment46
Free space managment46myrajendra
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
Wayne Jones Jnr
 
File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1
Amir Payberah
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
Janki Shah
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Drishti Bhalla
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
sgpraju
 
FILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMSFILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMS
Abhishek Dutta
 
Processes and threads
Processes and threadsProcesses and threads
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
Maitree Patel
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File Management
Damian T. Gordon
 
Buffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya JyothiBuffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya Jyothi
Sowmya Jyothi
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
Wayne Jones Jnr
 

What's hot (20)

Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Disk structure
Disk structureDisk structure
Disk structure
 
Allocation and free space management
Allocation and free space managementAllocation and free space management
Allocation and free space management
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
 
Operations on Processes
Operations on ProcessesOperations on Processes
Operations on Processes
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
 
FILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMSFILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMS
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File Management
 
Buffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya JyothiBuffer cache unix ppt Mrs.Sowmya Jyothi
Buffer cache unix ppt Mrs.Sowmya Jyothi
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 

Viewers also liked

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
overcertified
 
File management
File managementFile management
File management
Vishal Singh
 
File management ppt
File management pptFile management ppt
File management pptmarotti
 
Ch11: File System Interface
Ch11: File System InterfaceCh11: File System Interface
Ch11: File System Interface
Ahmar 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 computing
Deepak 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 tables
shashikant 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
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
File system
File systemFile system
File system
Harleen Johal
 

Viewers also liked (13)

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

Similar to File implementation

File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptx
Rajapriya82
 
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
Zainab Almugbel
 
Chapter13
Chapter13Chapter13
Chapter13
gourab87
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OSC.U
 
Query processing and optimization
Query processing and optimizationQuery processing and optimization
Query processing and optimizationArif A.
 
File Allocation Methods.ppt
File Allocation Methods.pptFile Allocation Methods.ppt
File Allocation Methods.ppt
BharathiLakshmiAAssi
 
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
siragezeynu
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
HelalMirzad
 
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
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
Abhishek Pachisia
 
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
Chinmaya 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 NFS
United International University
 
File Management.ppt
File Management.pptFile Management.ppt
File Management.ppt
JeelBhanderi4
 
Ch12_OS_Lecture 5.pdf
Ch12_OS_Lecture 5.pdfCh12_OS_Lecture 5.pdf
Ch12_OS_Lecture 5.pdf
AllinOne746595
 

Similar to File implementation (20)

File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptx
 
File system implementation
File system implementationFile system implementation
File system implementation
 
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
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
OSCh12
OSCh12OSCh12
OSCh12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
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)
 
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
 

More from 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
 

More from 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
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 

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