SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
File system internals
    Tanenbaum, Chapter 4



   COMP3231
Operating Systems
Architecture of the OS storage stack
                              Application

File system:                   FD table
                               OF table
• Hides physical location
  of data on the disk            VFS
                                  FS
• Exposes: directory          Buffer cache
  hierarchy, symbolic file
                             Disk scheduler
  names, random-access
  files, protection          Device driver




                                              2
Some popular file systems
   • FAT16                         • HFS+
   • FAT32                         • UFS2
   • NTFS                          • ZFS
   • Ext2                          • JFS
   • Ext3                          • OCFS
   • Ext4                          • Btrfs
   • ReiserFS                      • JFFS2
   • XFS                           • ExFAT
   • ISO9660                       • UBIFS

Question: why are there so many?
                                             3
Why are there so many?
• Different physical nature of storage devices
   – Ext3 is optimised for magnetic disks
   – JFFS2 is optimised for flash memory devices
   – ISO9660 is optimised for CDROM
• Different storage capacities
   – FAT16 does not support drives >2GB
   – FAT32 becomes inefficient on drives >32GB
   – Btrfs is designed to scale to multi-TB disk arrays
• Different CPU and memory requirements
   – FAT16 is not suitable for modern PCs but is a good fit for
     many embedded devices
• Proprietary standards
   – NTFS may be a nice FS, but its specification is closed
                                                                  4
Assumptions

• In this lecture we focus on file systems for magnetic
  disks
   – Rotational delay
      • 8ms worst case for 7200rpm drive
   – Seek time
      • ~15ms worst case
   – For comparison, disk-to-buffer transfer speed of a modern
     drive is ~10µs per 4K block.
• Conclusion: keep blocks that are likely to be accessed
  together close to each other


                                                            5
Implementing a file system
• The FS must map symbolic file
  names into block addresses
• The FS must keep track of
   – which blocks belong to which files.
   – in what order the blocks form the
     file
   – which blocks are free for allocation
• Given a logical region of a file, the
  FS must track the corresponding                           File system
  block(s) on disk.
                                                4                             7
   – Stored in file system metadata
                                                            8    2
                                            5           1
                                                    6                3
                                                                          6
Allocation strategies

• Contiguous allocation
 ✔
     Easy bookkeeping (need to keep track of the starting block
     and length of the file)
 ✔
     Increases performance for sequential operations
 ✗
     Need the maximum size for the file at the time of creation
 ✗
     As files are deleted, free space becomes divided into many
     small chunks (external fragmentation)
Example: ISO 9660 (CDROM FS)

                         1 2 3 4 5 6 7 8
            metadata

                                                                  7
Allocation strategies
• Dynamic allocation
   – Disk space allocated in portions as needed
   – Allocation occurs in fixed-size blocks
   ✔
       No external fragmentation
   ✔
       Does not require pre-allocating disk space
   ✗
       Partially filled blocks (internal fragmentation)
   ✗
       File blocks are scattered across the disk
   ✗
       Complex metadata management (maintain the list of blocks for each
       file)
                   1
                   2
                   3
                   4
                   5
                   6
                   7
                   8
                                                                    8
External and internal fragmentation

• External fragmentation
   – The space wasted external to the allocated memory
     regions
   – Memory space exists to satisfy a request but it is unusable
     as it is not contiguous
• Internal fragmentation
   – The space wasted internal to the allocated memory
     regions
   – Allocated memory may be slightly larger than requested
     memory; this size difference is wasted memory internal to
     a partition


                                                              9
Linked list allocation

• Each block contains a pointer to the next block in the
  chain. Free blocks are also linked in a chain.
   ✔
       Only single metadata entry per file
   ✔
       Best for sequential files




             1      4              2         3



Question: What are the downsides?
                                                           10
Linked list allocation

• Each block contains a pointer to the next block in the
  chain. Free blocks are also linked in a chain.
   ✔
       Only single metadata entry per file
   ✔
       Best for sequential files




             1      4              2          3

   ✗
       Poor for random access
   ✗
       Blocks end up scattered across the disk due to free list
       eventually being randomised                                11
File allocation table
• Keep a map of the entire FS in a separate table
   – A table entry contains the number of the next block of the file
   – The last block in a file and empty blocks are marked using
     reserved values
• The table is stored on the disk and is replicated in memory
• Random access is fast (following the in-memory list)




            1      4            2             3

                Question: any issues with this design?         12
File allocation table
• Issues
  – Requires a lot of memory for large disks
     • 200GB = 200*10^6 * 1K-blocks ==>
       200*10^6 FAT entries = 800MB
  – Free block lookup is slow




           1     4              2          3

                                               13
File allocation table

• Examples
  – FAT12, FAT16, FAT32




 reserved   FAT1   FAT2           data blocks




                                                14
inode-based FS structure

• Idea: separate table (index-node or i-node) for each file.
   – Only keep table for open files in memory
   – Fast random access
• The most popular FS structure today




           1      4           2            3

                                                          15
i-node implementation issues

• i-nodes occupy one or several disk areas



          i-nodes               data blocks

• i-nodes are allocated dynamically, hence free-space
  management is required for i-nodes
   – Use fixed-size i-nodes to simplify dynamic allocation
   – Reserve the last i-node entry for a pointer to an extension
     i-node



                                                              16
i-node implementation issues




                               17
i-node implementation issues
• Free-space management
  – Approach 1: linked list of free blocks
  – Approach 2: keep bitmaps of free blocks and free i-nodes




                                                          18
Free block list
• List of all unallocated blocks
• Background jobs can re-order list for better contiguity
• Store in free blocks themselves
   – Does not reduce disk capacity
• Only one block of pointers need be kept in the main
  memory




                                                            19
Free block list




(a) Almost-full block of pointers to free disk blocks in RAM
   ●   three blocks of pointers on disk
(b) Result of freeing a 3-block file
(c) Alternative strategy for handling 3 free blocks
   ●   shaded entries are pointers to free disk blocks

                                                               20
Bit tables
• Individual bits in a bit vector flags used/free blocks
• 16GB disk with 512-byte blocks --> 4MB table
• May be too large to hold in main memory
• Expensive to search
   – But may use a two level table
• Concentrating (de)allocations in a portion of the bitmap
  has desirable effect of concentrating access
• Simple to find contiguous free space




                                                           21
Implementing directories

• Directories are stored like normal files
   – directory entries are contained inside data blocks
• The FS assigns special meaning to the content of these
  files
   – a directory file is a list of directory entries
   – a directory entry contains file name, attributes, and the file
     i-node number
       • maps human-oriented file name to a system-oriented
         name




                                                               22
Fixed-size vs variable-size directory entries

• Fixed-size directory entries
   – Either too small
      • Example: DOS 8+3 characters
   – Or waste too much space
      • Example: 255 characters per file name
• Variable-size directory entries
   – Freeing variable length entries can create external
     fragmentation in directory blocks
       • Can compact when block is in RAM



                                                           23
Directory listing

• Locating a file in a directory
   – Linear scan
      • Use a directory cache to speed-up search
   – Hash lookup
   – B-tree (100's of thousands entries)




                                                   24
Storing file attributes




(a) disk addresses and attributes in directory entry
   – FAT
(b) directory in which each entry just refers to an i-node
   –   UNIX


                                                             25
Trade-off in FS block size
• File systems deal with 2 types of blocks
   – Disk blocks or sectors (usually 512 bytes)
   – File system blocks 512 * 2^N bytes
   – What is the optimal N?
• Larger blocks require less FS metadata
• Smaller blocks waste less disk space
• Sequential Access
   – The larger the block size, the fewer I/O operations required
• Random Access
   – The larger the block size, the more unrelated data loaded.
   – Spatial locality of access improves the situation
• Choosing an appropriate block size is a compromise
                                                                    26

Más contenido relacionado

La actualidad más candente

AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksZubair Nabi
 
Coal presentationt
Coal presentationtCoal presentationt
Coal presentationtfika sweety
 
Data Consistency Enhancement in Writeback mode of Journaling using Backpointers
Data Consistency Enhancement in Writeback mode of Journaling using BackpointersData Consistency Enhancement in Writeback mode of Journaling using Backpointers
Data Consistency Enhancement in Writeback mode of Journaling using BackpointersRohan Waghere
 
Mass Storage Devices
Mass Storage DevicesMass Storage Devices
Mass Storage DevicesPrabu U
 
Introduction to Disk Storage
Introduction to Disk StorageIntroduction to Disk Storage
Introduction to Disk StorageAmir Villas
 
Mass storage device
Mass storage deviceMass storage device
Mass storage deviceRaza Umer
 
Mass storage structurefinal
Mass storage structurefinalMass storage structurefinal
Mass storage structurefinalmarangburu42
 
B tree file system
B tree file systemB tree file system
B tree file systemDinesh Gupta
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in LinuxHenry Osborne
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linuxZkre Saleh
 

La actualidad más candente (18)

AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
 
Coal presentationt
Coal presentationtCoal presentationt
Coal presentationt
 
Datastorage
DatastorageDatastorage
Datastorage
 
Data Consistency Enhancement in Writeback mode of Journaling using Backpointers
Data Consistency Enhancement in Writeback mode of Journaling using BackpointersData Consistency Enhancement in Writeback mode of Journaling using Backpointers
Data Consistency Enhancement in Writeback mode of Journaling using Backpointers
 
Disk structure
Disk structureDisk structure
Disk structure
 
Mass Storage Devices
Mass Storage DevicesMass Storage Devices
Mass Storage Devices
 
Introduction to Disk Storage
Introduction to Disk StorageIntroduction to Disk Storage
Introduction to Disk Storage
 
Storage memory
Storage memoryStorage memory
Storage memory
 
Mass storage device
Mass storage deviceMass storage device
Mass storage device
 
Disk
DiskDisk
Disk
 
06 external memory
06 external memory06 external memory
06 external memory
 
external_memory
external_memoryexternal_memory
external_memory
 
Mass storage structurefinal
Mass storage structurefinalMass storage structurefinal
Mass storage structurefinal
 
B tree file system
B tree file systemB tree file system
B tree file system
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
Hard disks
Hard disksHard disks
Hard disks
 

Destacado

Future of cities meda city congress november 2012
Future of cities   meda city congress november 2012Future of cities   meda city congress november 2012
Future of cities meda city congress november 2012Alain Jordà
 
TEC CONTAINER - DELIVERED 2013 - 2016
TEC CONTAINER - DELIVERED 2013 - 2016TEC CONTAINER - DELIVERED 2013 - 2016
TEC CONTAINER - DELIVERED 2013 - 2016teccontainer
 
EYE Reporter Issue 1 2011
EYE Reporter Issue 1 2011EYE Reporter Issue 1 2011
EYE Reporter Issue 1 2011Steve @ insider
 
цахим судалгаа
цахим судалгаа цахим судалгаа
цахим судалгаа solongobaga
 
Learning resources in Education: Updates
Learning resources in Education: UpdatesLearning resources in Education: Updates
Learning resources in Education: Updateswimdboer
 
Cpa network presentation_unisender_conf_prefinal
Cpa network presentation_unisender_conf_prefinalCpa network presentation_unisender_conf_prefinal
Cpa network presentation_unisender_conf_prefinalKira Zhestkova
 
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012onthewight
 
Saigon luxury apartment ms.duyên
Saigon luxury apartment   ms.duyênSaigon luxury apartment   ms.duyên
Saigon luxury apartment ms.duyêntranduyen76
 
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...Kira Zhestkova
 
Saigon luxury apartment
Saigon luxury apartment Saigon luxury apartment
Saigon luxury apartment tranduyen76
 
49. upload lks 2015 web design (1)
49. upload lks 2015 web design (1)49. upload lks 2015 web design (1)
49. upload lks 2015 web design (1)Smp Al-Hadi
 
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রম
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রমসৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রম
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রমAbul Bashar
 
Breast Cancer Management
Breast Cancer ManagementBreast Cancer Management
Breast Cancer ManagementAbdul Basit
 
Memoràndum 2013 maquetat
Memoràndum 2013 maquetatMemoràndum 2013 maquetat
Memoràndum 2013 maquetatJosep Miquel
 
Удержание пользователей (User Retention) // CPA Network Russia
Удержание пользователей (User Retention) // CPA Network RussiaУдержание пользователей (User Retention) // CPA Network Russia
Удержание пользователей (User Retention) // CPA Network RussiaKira Zhestkova
 
Sacomreal hùng vương
Sacomreal hùng vươngSacomreal hùng vương
Sacomreal hùng vươngtranduyen76
 
dMT SPC Presentation Products-engl.
dMT SPC Presentation Products-engl.dMT SPC Presentation Products-engl.
dMT SPC Presentation Products-engl.dmtgms
 
Commemoration of the Great War 1914-1918 by David Langford
Commemoration of the Great War 1914-1918 by David LangfordCommemoration of the Great War 1914-1918 by David Langford
Commemoration of the Great War 1914-1918 by David Langfordonthewight
 
Blackfreedom , terrific presentation
Blackfreedom , terrific presentationBlackfreedom , terrific presentation
Blackfreedom , terrific presentationJaseem Abid
 

Destacado (20)

Future of cities meda city congress november 2012
Future of cities   meda city congress november 2012Future of cities   meda city congress november 2012
Future of cities meda city congress november 2012
 
TEC CONTAINER - DELIVERED 2013 - 2016
TEC CONTAINER - DELIVERED 2013 - 2016TEC CONTAINER - DELIVERED 2013 - 2016
TEC CONTAINER - DELIVERED 2013 - 2016
 
EYE Reporter Issue 1 2011
EYE Reporter Issue 1 2011EYE Reporter Issue 1 2011
EYE Reporter Issue 1 2011
 
цахим судалгаа
цахим судалгаа цахим судалгаа
цахим судалгаа
 
Learning resources in Education: Updates
Learning resources in Education: UpdatesLearning resources in Education: Updates
Learning resources in Education: Updates
 
Cpa network presentation_unisender_conf_prefinal
Cpa network presentation_unisender_conf_prefinalCpa network presentation_unisender_conf_prefinal
Cpa network presentation_unisender_conf_prefinal
 
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012
Prof. Mark Hanson's Fat, Fate & Obesity talk to IW Cafe Scientifique sept 2012
 
Saigon luxury apartment ms.duyên
Saigon luxury apartment   ms.duyênSaigon luxury apartment   ms.duyên
Saigon luxury apartment ms.duyên
 
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...
РИФ+КИБ 2013 // Как создать персонализированный маркетинг? // OZON.ru (Кира Ж...
 
Saigon luxury apartment
Saigon luxury apartment Saigon luxury apartment
Saigon luxury apartment
 
JAXB
JAXBJAXB
JAXB
 
49. upload lks 2015 web design (1)
49. upload lks 2015 web design (1)49. upload lks 2015 web design (1)
49. upload lks 2015 web design (1)
 
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রম
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রমসৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রম
সৃজনশীল প্রশ্ন, শিক্ষক ও শ্রেণি কার্যক্রম
 
Breast Cancer Management
Breast Cancer ManagementBreast Cancer Management
Breast Cancer Management
 
Memoràndum 2013 maquetat
Memoràndum 2013 maquetatMemoràndum 2013 maquetat
Memoràndum 2013 maquetat
 
Удержание пользователей (User Retention) // CPA Network Russia
Удержание пользователей (User Retention) // CPA Network RussiaУдержание пользователей (User Retention) // CPA Network Russia
Удержание пользователей (User Retention) // CPA Network Russia
 
Sacomreal hùng vương
Sacomreal hùng vươngSacomreal hùng vương
Sacomreal hùng vương
 
dMT SPC Presentation Products-engl.
dMT SPC Presentation Products-engl.dMT SPC Presentation Products-engl.
dMT SPC Presentation Products-engl.
 
Commemoration of the Great War 1914-1918 by David Langford
Commemoration of the Great War 1914-1918 by David LangfordCommemoration of the Great War 1914-1918 by David Langford
Commemoration of the Great War 1914-1918 by David Langford
 
Blackfreedom , terrific presentation
Blackfreedom , terrific presentationBlackfreedom , terrific presentation
Blackfreedom , terrific presentation
 

Similar a Lect09

Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris MasonTerry Wang
 
The evolution of linux file system
The evolution of linux file systemThe evolution of linux file system
The evolution of linux file systemGang He
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementationWelly Dian Astika
 
storage techniques_overview-1.pptx
storage techniques_overview-1.pptxstorage techniques_overview-1.pptx
storage techniques_overview-1.pptx20CS102RAMMPRASHATHK
 
Learn about log structured file system
Learn about log structured file systemLearn about log structured file system
Learn about log structured file systemGang He
 
De-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisDe-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisAndrew Case
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Seshu Chakravarthy
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureHaris456
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.pptBUSHRASHAIKH804312
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Ahmed El-Arabawy
 
19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdf19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdfJESUNPK
 
Secondary storage devices
Secondary storage devices Secondary storage devices
Secondary storage devices Slideshare
 

Similar a Lect09 (20)

Extlect03
Extlect03Extlect03
Extlect03
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
The evolution of linux file system
The evolution of linux file systemThe evolution of linux file system
The evolution of linux file system
 
Ext filesystem4
Ext filesystem4Ext filesystem4
Ext filesystem4
 
Os
OsOs
Os
 
Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
 
Windows File Systems
Windows File SystemsWindows File Systems
Windows File Systems
 
storage techniques_overview-1.pptx
storage techniques_overview-1.pptxstorage techniques_overview-1.pptx
storage techniques_overview-1.pptx
 
Learn about log structured file system
Learn about log structured file systemLearn about log structured file system
Learn about log structured file system
 
De-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisDe-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory Analysis
 
Windows File Systems
Windows File SystemsWindows File Systems
Windows File Systems
 
Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02Secondarystoragedevices1 130119040144-phpapp02
Secondarystoragedevices1 130119040144-phpapp02
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer Architecture
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
Unit 4 DBMS.ppt
Unit 4 DBMS.pptUnit 4 DBMS.ppt
Unit 4 DBMS.ppt
 
19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdf19IS305_U4_LP10_LM10-22-23.pdf
19IS305_U4_LP10_LM10-22-23.pdf
 
Secondary storage devices
Secondary storage devices Secondary storage devices
Secondary storage devices
 
Windows file system
Windows file systemWindows file system
Windows file system
 

Más de Vin Voro

Tele3113 tut6
Tele3113 tut6Tele3113 tut6
Tele3113 tut6Vin Voro
 
Tele3113 tut5
Tele3113 tut5Tele3113 tut5
Tele3113 tut5Vin Voro
 
Tele3113 tut4
Tele3113 tut4Tele3113 tut4
Tele3113 tut4Vin Voro
 
Tele3113 tut1
Tele3113 tut1Tele3113 tut1
Tele3113 tut1Vin Voro
 
Tele3113 tut3
Tele3113 tut3Tele3113 tut3
Tele3113 tut3Vin Voro
 
Tele3113 tut2
Tele3113 tut2Tele3113 tut2
Tele3113 tut2Vin Voro
 
Tele3113 wk11tue
Tele3113 wk11tueTele3113 wk11tue
Tele3113 wk11tueVin Voro
 
Tele3113 wk10wed
Tele3113 wk10wedTele3113 wk10wed
Tele3113 wk10wedVin Voro
 
Tele3113 wk10tue
Tele3113 wk10tueTele3113 wk10tue
Tele3113 wk10tueVin Voro
 
Tele3113 wk11wed
Tele3113 wk11wedTele3113 wk11wed
Tele3113 wk11wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk9tue
Tele3113 wk9tueTele3113 wk9tue
Tele3113 wk9tueVin Voro
 
Tele3113 wk8wed
Tele3113 wk8wedTele3113 wk8wed
Tele3113 wk8wedVin Voro
 
Tele3113 wk9wed
Tele3113 wk9wedTele3113 wk9wed
Tele3113 wk9wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk7tue
Tele3113 wk7tueTele3113 wk7tue
Tele3113 wk7tueVin Voro
 
Tele3113 wk6wed
Tele3113 wk6wedTele3113 wk6wed
Tele3113 wk6wedVin Voro
 
Tele3113 wk6tue
Tele3113 wk6tueTele3113 wk6tue
Tele3113 wk6tueVin Voro
 
Tele3113 wk5tue
Tele3113 wk5tueTele3113 wk5tue
Tele3113 wk5tueVin Voro
 

Más de Vin Voro (20)

Tele3113 tut6
Tele3113 tut6Tele3113 tut6
Tele3113 tut6
 
Tele3113 tut5
Tele3113 tut5Tele3113 tut5
Tele3113 tut5
 
Tele3113 tut4
Tele3113 tut4Tele3113 tut4
Tele3113 tut4
 
Tele3113 tut1
Tele3113 tut1Tele3113 tut1
Tele3113 tut1
 
Tele3113 tut3
Tele3113 tut3Tele3113 tut3
Tele3113 tut3
 
Tele3113 tut2
Tele3113 tut2Tele3113 tut2
Tele3113 tut2
 
Tele3113 wk11tue
Tele3113 wk11tueTele3113 wk11tue
Tele3113 wk11tue
 
Tele3113 wk10wed
Tele3113 wk10wedTele3113 wk10wed
Tele3113 wk10wed
 
Tele3113 wk10tue
Tele3113 wk10tueTele3113 wk10tue
Tele3113 wk10tue
 
Tele3113 wk11wed
Tele3113 wk11wedTele3113 wk11wed
Tele3113 wk11wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk9tue
Tele3113 wk9tueTele3113 wk9tue
Tele3113 wk9tue
 
Tele3113 wk8wed
Tele3113 wk8wedTele3113 wk8wed
Tele3113 wk8wed
 
Tele3113 wk9wed
Tele3113 wk9wedTele3113 wk9wed
Tele3113 wk9wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk7tue
Tele3113 wk7tueTele3113 wk7tue
Tele3113 wk7tue
 
Tele3113 wk6wed
Tele3113 wk6wedTele3113 wk6wed
Tele3113 wk6wed
 
Tele3113 wk6tue
Tele3113 wk6tueTele3113 wk6tue
Tele3113 wk6tue
 
Tele3113 wk5tue
Tele3113 wk5tueTele3113 wk5tue
Tele3113 wk5tue
 

Último

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
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
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
 
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
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
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
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
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
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
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
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 

Último (20)

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)
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
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)
 
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
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.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
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
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
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
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
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
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...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 

Lect09

  • 1. File system internals Tanenbaum, Chapter 4 COMP3231 Operating Systems
  • 2. Architecture of the OS storage stack Application File system: FD table OF table • Hides physical location of data on the disk VFS FS • Exposes: directory Buffer cache hierarchy, symbolic file Disk scheduler names, random-access files, protection Device driver 2
  • 3. Some popular file systems • FAT16 • HFS+ • FAT32 • UFS2 • NTFS • ZFS • Ext2 • JFS • Ext3 • OCFS • Ext4 • Btrfs • ReiserFS • JFFS2 • XFS • ExFAT • ISO9660 • UBIFS Question: why are there so many? 3
  • 4. Why are there so many? • Different physical nature of storage devices – Ext3 is optimised for magnetic disks – JFFS2 is optimised for flash memory devices – ISO9660 is optimised for CDROM • Different storage capacities – FAT16 does not support drives >2GB – FAT32 becomes inefficient on drives >32GB – Btrfs is designed to scale to multi-TB disk arrays • Different CPU and memory requirements – FAT16 is not suitable for modern PCs but is a good fit for many embedded devices • Proprietary standards – NTFS may be a nice FS, but its specification is closed 4
  • 5. Assumptions • In this lecture we focus on file systems for magnetic disks – Rotational delay • 8ms worst case for 7200rpm drive – Seek time • ~15ms worst case – For comparison, disk-to-buffer transfer speed of a modern drive is ~10µs per 4K block. • Conclusion: keep blocks that are likely to be accessed together close to each other 5
  • 6. Implementing a file system • The FS must map symbolic file names into block addresses • The FS must keep track of – which blocks belong to which files. – in what order the blocks form the file – which blocks are free for allocation • Given a logical region of a file, the FS must track the corresponding File system block(s) on disk. 4 7 – Stored in file system metadata 8 2 5 1 6 3 6
  • 7. Allocation strategies • Contiguous allocation ✔ Easy bookkeeping (need to keep track of the starting block and length of the file) ✔ Increases performance for sequential operations ✗ Need the maximum size for the file at the time of creation ✗ As files are deleted, free space becomes divided into many small chunks (external fragmentation) Example: ISO 9660 (CDROM FS) 1 2 3 4 5 6 7 8 metadata 7
  • 8. Allocation strategies • Dynamic allocation – Disk space allocated in portions as needed – Allocation occurs in fixed-size blocks ✔ No external fragmentation ✔ Does not require pre-allocating disk space ✗ Partially filled blocks (internal fragmentation) ✗ File blocks are scattered across the disk ✗ Complex metadata management (maintain the list of blocks for each file) 1 2 3 4 5 6 7 8 8
  • 9. External and internal fragmentation • External fragmentation – The space wasted external to the allocated memory regions – Memory space exists to satisfy a request but it is unusable as it is not contiguous • Internal fragmentation – The space wasted internal to the allocated memory regions – Allocated memory may be slightly larger than requested memory; this size difference is wasted memory internal to a partition 9
  • 10. Linked list allocation • Each block contains a pointer to the next block in the chain. Free blocks are also linked in a chain. ✔ Only single metadata entry per file ✔ Best for sequential files 1 4 2 3 Question: What are the downsides? 10
  • 11. Linked list allocation • Each block contains a pointer to the next block in the chain. Free blocks are also linked in a chain. ✔ Only single metadata entry per file ✔ Best for sequential files 1 4 2 3 ✗ Poor for random access ✗ Blocks end up scattered across the disk due to free list eventually being randomised 11
  • 12. File allocation table • Keep a map of the entire FS in a separate table – A table entry contains the number of the next block of the file – The last block in a file and empty blocks are marked using reserved values • The table is stored on the disk and is replicated in memory • Random access is fast (following the in-memory list) 1 4 2 3 Question: any issues with this design? 12
  • 13. File allocation table • Issues – Requires a lot of memory for large disks • 200GB = 200*10^6 * 1K-blocks ==> 200*10^6 FAT entries = 800MB – Free block lookup is slow 1 4 2 3 13
  • 14. File allocation table • Examples – FAT12, FAT16, FAT32 reserved FAT1 FAT2 data blocks 14
  • 15. inode-based FS structure • Idea: separate table (index-node or i-node) for each file. – Only keep table for open files in memory – Fast random access • The most popular FS structure today 1 4 2 3 15
  • 16. i-node implementation issues • i-nodes occupy one or several disk areas i-nodes data blocks • i-nodes are allocated dynamically, hence free-space management is required for i-nodes – Use fixed-size i-nodes to simplify dynamic allocation – Reserve the last i-node entry for a pointer to an extension i-node 16
  • 18. i-node implementation issues • Free-space management – Approach 1: linked list of free blocks – Approach 2: keep bitmaps of free blocks and free i-nodes 18
  • 19. Free block list • List of all unallocated blocks • Background jobs can re-order list for better contiguity • Store in free blocks themselves – Does not reduce disk capacity • Only one block of pointers need be kept in the main memory 19
  • 20. Free block list (a) Almost-full block of pointers to free disk blocks in RAM ● three blocks of pointers on disk (b) Result of freeing a 3-block file (c) Alternative strategy for handling 3 free blocks ● shaded entries are pointers to free disk blocks 20
  • 21. Bit tables • Individual bits in a bit vector flags used/free blocks • 16GB disk with 512-byte blocks --> 4MB table • May be too large to hold in main memory • Expensive to search – But may use a two level table • Concentrating (de)allocations in a portion of the bitmap has desirable effect of concentrating access • Simple to find contiguous free space 21
  • 22. Implementing directories • Directories are stored like normal files – directory entries are contained inside data blocks • The FS assigns special meaning to the content of these files – a directory file is a list of directory entries – a directory entry contains file name, attributes, and the file i-node number • maps human-oriented file name to a system-oriented name 22
  • 23. Fixed-size vs variable-size directory entries • Fixed-size directory entries – Either too small • Example: DOS 8+3 characters – Or waste too much space • Example: 255 characters per file name • Variable-size directory entries – Freeing variable length entries can create external fragmentation in directory blocks • Can compact when block is in RAM 23
  • 24. Directory listing • Locating a file in a directory – Linear scan • Use a directory cache to speed-up search – Hash lookup – B-tree (100's of thousands entries) 24
  • 25. Storing file attributes (a) disk addresses and attributes in directory entry – FAT (b) directory in which each entry just refers to an i-node – UNIX 25
  • 26. Trade-off in FS block size • File systems deal with 2 types of blocks – Disk blocks or sectors (usually 512 bytes) – File system blocks 512 * 2^N bytes – What is the optimal N? • Larger blocks require less FS metadata • Smaller blocks waste less disk space • Sequential Access – The larger the block size, the fewer I/O operations required • Random Access – The larger the block size, the more unrelated data loaded. – Spatial locality of access improves the situation • Choosing an appropriate block size is a compromise 26