SlideShare uma empresa Scribd logo
1 de 26
Allocation and free
space management
M.Rishi vindhya,
I-MSc(IT),
Nadar saraswathi college of arts and
science, theni.
Allocation Methods - Contiguous
• An allocation method refers to how disk blocks are
allocated for files:
• Contiguous allocation – each file occupies set of
contiguous blocks
o Best performance in most cases
o Simple – only starting location (block #) and length (number of blocks) are
required
o Problems include finding space for file, knowing file size, external
fragmentation, need for compaction off-line (downtime) or on-line
Contiguous Allocation
• Mapping from logical to physical
LA/512
Q
R
Block to be accessed = Q + starting address
Displacement into block = R
Contiguous Allocation of Disk Space
Extent-Based Systems
• Many newer file systems (i.e., Veritas File System)
use a modified contiguous allocation scheme
• Extent-based file systems allocate disk blocks in
extents
• An extent is a contiguous block of disks
o Extents are allocated for file allocation
o A file consists of one or more extents
Allocation Methods - Linked
• Linked allocation – each file a linked list of blocks
o File ends at nil pointer
o No external fragmentation
o Each block contains pointer to next block
o No compaction, external fragmentation
o Free space management system called when new block needed
o Improve efficiency by clustering blocks into groups but increases internal
fragmentation
o Reliability can be a problem
o Locating a block can take many I/Os and disk seeks
• FAT (File Allocation Table) variation
o Beginning of volume has table, indexed by block number
o Much like a linked list, but faster on disk and cacheable
o New block allocation simple
Linked Allocation
• Each file is a linked list of disk blocks: blocks may be
scattered anywhere on the disk
pointerblock =
Linked Allocation
• Mapping
Block to be accessed is the Qth block in the linked chain of blocks
representing the file.
Displacement into block = R + 1
LA/511
Q
R
Linked Allocation
File-Allocation Table
Allocation Methods -
Indexed
• Indexed allocation
o Each file has its own index block(s) of pointers to its data blocks
• Logical view
index table
Example of Indexed
Allocation
Indexed Allocation (Cont.)
• Need index table
• Random access
• Dynamic access without external fragmentation, but
have overhead of index block
• Mapping from logical to physical in a file of maximum
size of 256K bytes and block size of 512 bytes. We
need only 1 block for index table
LA/512
Q
R
Q = displacement into index table
R = displacement into block
Mapping (Cont.)
• Mapping from logical to physical in a file of unbounded length
(block size of 512 words)
• Linked scheme – Link blocks of index table (no limit on size)
LA / (512 x 511)
Q1
R1
Q1 = block of index table
R1 is used as follows:
R1 / 512
Q2
R2
Q2 = displacement into block of index table
R2 displacement into block of file:
Mapping (Cont.)
• Two-level index (4K blocks could store 1,024 four-byte pointers in outer
index -> 1,048,567 data blocks and file size of up to 4GB)
LA / (512 x 512)
Q1
R1
Q1 = displacement into outer-index
R1 is used as follows:
R1 / 512
Q2
R2
Q2 = displacement into block of index table
R2 displacement into block of file:
Mapping (Cont.)
outer-index
index table file
(4K bytes per block, 32-bit addresses)
Note: More
index
blocks than
can be
addressed
with 32-bit
file pointer
Performance
• Best method depends on file access type
o Contiguous great for sequential and random
• Linked good for sequential, not random
• Declare access type at creation -> select either
contiguous or linked
• Indexed more complex
o Single block access could require 2 index block reads then data block read
o Clustering can help improve throughput, reduce CPU overhead
Performance (Cont.)
• Adding instructions to the execution path to save one
disk I/O is reasonable
o Intel Core i7 Extreme Edition 990x (2011) at 3.46Ghz = 159,000 MIPS
• http://en.wikipedia.org/wiki/Instructions_per_second
o Typical disk drive at 250 I/Os per second
• 159,000 MIPS / 250 = 630 million instructions during one disk I/O
o Fast SSD drives provide 60,000 IOPS
• 159,000 MIPS / 60,000 = 2.65 millions instructions during one disk I/O
Free-Space Management
• File system maintains free-space list to track available blocks/clusters
o (Using term “block” for simplicity)
• Bit vector or bit map (n blocks)
…
0 1 2 n-1
bit[i] =
1  block[i] free
0  block[i] occupied
Block number calculation
(number of bits per word) *
(number of 0-value words) +
offset of first 1 bit
CPUs have instructions to return offset within word of first “1” bit
(Cont.)
• Bit map requires extra space
o Example:
block size = 4KB = 212 bytes
disk size = 240 bytes (1 terabyte)
n = 240/212 = 228 bits (or 256 MB)
if clusters of 4 blocks -> 64MB of memory
• Easy to get contiguous files
• Linked list (free list)
o Cannot get contiguous space easily
o No waste of space
o No need to traverse the entire list (if # free blocks recorded)
Disk
Free-Space Management
(Cont.)
• Grouping
o Modify linked list to store address of next n-1 free blocks in first free block, plus a
pointer to next block that contains free-block-pointers (like this one)
• Counting
o Because space is frequently contiguously used and freed, with contiguous-
allocation allocation, extents, or clustering
• Keep address of first free block and count of following free blocks
• Free space list then has entries containing addresses and counts
Free-Space Management
(Cont.)
• Space Maps
o Used in ZFS
o Consider meta-data I/O on very large file systems
• Full data structures like bit maps couldn’t fit in memory -> thousands of I/Os
o Divides device space into metaslab units and manages metaslabs
• Given volume can contain hundreds of metaslabs
o Each metaslab has associated space map
• Uses counting algorithm
o But records to log file rather than file system
• Log of all block activity, in time order, in counting format
o Metaslab activity -> load space map into memory in balanced-tree structure,
indexed by offset
• Replay log into that structure
• Combine contiguous free blocks into single entry
Performance
• Efficiency dependent on:
o Disk allocation and directory algorithms
o Types of data kept in file’s directory entry
o Pre-allocation or as-needed allocation of metadata structures
o Fixed-size or varying-size data structures
Performance (Cont.)
• Performance
o Keeping data and metadata close together
o Buffer cache – separate section of main memory for frequently used
blocks
o Synchronous writes sometimes requested by apps or needed by OS
• No buffering / caching – writes must hit disk before acknowledgement
• Asynchronous writes more common, buffer-able, faster
o Free-behind and read-ahead – techniques to optimize sequential access
o Reads frequently slower than writes

Mais conteúdo relacionado

Mais procurados

8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mountingrajshreemuthiah
 
Recovery with concurrent transaction
Recovery with concurrent transactionRecovery with concurrent transaction
Recovery with concurrent transactionlavanya marichamy
 
Memory allocation (4)
Memory allocation (4)Memory allocation (4)
Memory allocation (4)rockymani
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureVinit Raut
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler designAnul Chaudhary
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management SystemJanki Shah
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignmentKarthi Keyan
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesFlag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesComputer_ at_home
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor schedulingShashank Kapoor
 
Three Address code
Three Address code Three Address code
Three Address code Pooja Dixit
 
Datapath Design of Computer Architecture
Datapath Design of Computer ArchitectureDatapath Design of Computer Architecture
Datapath Design of Computer ArchitectureAbu Zaman
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMSkoolkampus
 

Mais procurados (20)

8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
Recovery with concurrent transaction
Recovery with concurrent transactionRecovery with concurrent transaction
Recovery with concurrent transaction
 
Memory allocation (4)
Memory allocation (4)Memory allocation (4)
Memory allocation (4)
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
File system structure
File system structureFile system structure
File system structure
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
File organization 1
File organization 1File organization 1
File organization 1
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignment
 
Buffer management
Buffer managementBuffer management
Buffer management
 
Crash recovery in database
Crash recovery in databaseCrash recovery in database
Crash recovery in database
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examplesFlag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examples
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
 
RAID
RAIDRAID
RAID
 
Three Address code
Three Address code Three Address code
Three Address code
 
Datapath Design of Computer Architecture
Datapath Design of Computer ArchitectureDatapath Design of Computer Architecture
Datapath Design of Computer Architecture
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMS
 

Semelhante a Allocation and free space management

Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementationWelly Dian Astika
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.pptBUSHRASHAIKH804312
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.pptHelalMirzad
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System ImplementationWayne Jones Jnr
 
Ch11 - Operating Systems
Ch11 - Operating SystemsCh11 - Operating Systems
Ch11 - Operating SystemsBala Krish
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OSC.U
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing extKrish_ver2
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptxItechAnand1
 
fileallocationmethods1-220104151603.pdf
fileallocationmethods1-220104151603.pdffileallocationmethods1-220104151603.pdf
fileallocationmethods1-220104151603.pdfAbhishekBhassia
 
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
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedTony Rogerson
 

Semelhante a Allocation and free space management (20)

Ch11 file system implementation
Ch11   file system implementationCh11   file system implementation
Ch11 file system implementation
 
chapter5-file system implementation.ppt
chapter5-file system implementation.pptchapter5-file system implementation.ppt
chapter5-file system implementation.ppt
 
OS Unit5.pptx
OS Unit5.pptxOS Unit5.pptx
OS Unit5.pptx
 
file management_part2_os_notes.ppt
file management_part2_os_notes.pptfile management_part2_os_notes.ppt
file management_part2_os_notes.ppt
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
Ch11 - Operating Systems
Ch11 - Operating SystemsCh11 - Operating Systems
Ch11 - Operating Systems
 
1650607.ppt
1650607.ppt1650607.ppt
1650607.ppt
 
File system implementation
File system implementationFile system implementation
File system implementation
 
OSCh12
OSCh12OSCh12
OSCh12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
4.4 hashing ext
4.4 hashing  ext4.4 hashing  ext
4.4 hashing ext
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptx
 
fileallocationmethods1-220104151603.pdf
fileallocationmethods1-220104151603.pdffileallocationmethods1-220104151603.pdf
fileallocationmethods1-220104151603.pdf
 
File allocation methods (1)
File allocation methods (1)File allocation methods (1)
File allocation methods (1)
 
Ch11
Ch11Ch11
Ch11
 
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
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - Advanced
 
Ext filesystem4
Ext filesystem4Ext filesystem4
Ext filesystem4
 

Mais de rajshreemuthiah (20)

oracle
oracleoracle
oracle
 
quality
qualityquality
quality
 
bigdata
bigdatabigdata
bigdata
 
polymorphism
polymorphismpolymorphism
polymorphism
 
solutions and understanding text analytics
solutions and understanding text analyticssolutions and understanding text analytics
solutions and understanding text analytics
 
interface
interfaceinterface
interface
 
Testing &ampdebugging
Testing &ampdebuggingTesting &ampdebugging
Testing &ampdebugging
 
concurrency control
concurrency controlconcurrency control
concurrency control
 
Education
EducationEducation
Education
 
Formal verification
Formal verificationFormal verification
Formal verification
 
Transaction management
Transaction management Transaction management
Transaction management
 
Multi thread
Multi threadMulti thread
Multi thread
 
System testing
System testingSystem testing
System testing
 
software maintenance
software maintenancesoftware maintenance
software maintenance
 
exception handling
exception handlingexception handling
exception handling
 
e governance
e governancee governance
e governance
 
recovery management
recovery managementrecovery management
recovery management
 
Implementing polymorphism
Implementing polymorphismImplementing polymorphism
Implementing polymorphism
 
Buffer managements
Buffer managementsBuffer managements
Buffer managements
 
os linux
os linuxos linux
os linux
 

Último

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Allocation and free space management

  • 1. Allocation and free space management M.Rishi vindhya, I-MSc(IT), Nadar saraswathi college of arts and science, theni.
  • 2. Allocation Methods - Contiguous • An allocation method refers to how disk blocks are allocated for files: • Contiguous allocation – each file occupies set of contiguous blocks o Best performance in most cases o Simple – only starting location (block #) and length (number of blocks) are required o Problems include finding space for file, knowing file size, external fragmentation, need for compaction off-line (downtime) or on-line
  • 3. Contiguous Allocation • Mapping from logical to physical LA/512 Q R Block to be accessed = Q + starting address Displacement into block = R
  • 5. Extent-Based Systems • Many newer file systems (i.e., Veritas File System) use a modified contiguous allocation scheme • Extent-based file systems allocate disk blocks in extents • An extent is a contiguous block of disks o Extents are allocated for file allocation o A file consists of one or more extents
  • 6. Allocation Methods - Linked • Linked allocation – each file a linked list of blocks o File ends at nil pointer o No external fragmentation o Each block contains pointer to next block o No compaction, external fragmentation o Free space management system called when new block needed o Improve efficiency by clustering blocks into groups but increases internal fragmentation o Reliability can be a problem o Locating a block can take many I/Os and disk seeks • FAT (File Allocation Table) variation o Beginning of volume has table, indexed by block number o Much like a linked list, but faster on disk and cacheable o New block allocation simple
  • 7. Linked Allocation • Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk pointerblock =
  • 8. Linked Allocation • Mapping Block to be accessed is the Qth block in the linked chain of blocks representing the file. Displacement into block = R + 1 LA/511 Q R
  • 11. Allocation Methods - Indexed • Indexed allocation o Each file has its own index block(s) of pointers to its data blocks • Logical view index table
  • 13. Indexed Allocation (Cont.) • Need index table • Random access • Dynamic access without external fragmentation, but have overhead of index block • Mapping from logical to physical in a file of maximum size of 256K bytes and block size of 512 bytes. We need only 1 block for index table LA/512 Q R Q = displacement into index table R = displacement into block
  • 14. Mapping (Cont.) • Mapping from logical to physical in a file of unbounded length (block size of 512 words) • Linked scheme – Link blocks of index table (no limit on size) LA / (512 x 511) Q1 R1 Q1 = block of index table R1 is used as follows: R1 / 512 Q2 R2 Q2 = displacement into block of index table R2 displacement into block of file:
  • 15. Mapping (Cont.) • Two-level index (4K blocks could store 1,024 four-byte pointers in outer index -> 1,048,567 data blocks and file size of up to 4GB) LA / (512 x 512) Q1 R1 Q1 = displacement into outer-index R1 is used as follows: R1 / 512 Q2 R2 Q2 = displacement into block of index table R2 displacement into block of file:
  • 17. (4K bytes per block, 32-bit addresses) Note: More index blocks than can be addressed with 32-bit file pointer
  • 18. Performance • Best method depends on file access type o Contiguous great for sequential and random • Linked good for sequential, not random • Declare access type at creation -> select either contiguous or linked • Indexed more complex o Single block access could require 2 index block reads then data block read o Clustering can help improve throughput, reduce CPU overhead
  • 19. Performance (Cont.) • Adding instructions to the execution path to save one disk I/O is reasonable o Intel Core i7 Extreme Edition 990x (2011) at 3.46Ghz = 159,000 MIPS • http://en.wikipedia.org/wiki/Instructions_per_second o Typical disk drive at 250 I/Os per second • 159,000 MIPS / 250 = 630 million instructions during one disk I/O o Fast SSD drives provide 60,000 IOPS • 159,000 MIPS / 60,000 = 2.65 millions instructions during one disk I/O
  • 20. Free-Space Management • File system maintains free-space list to track available blocks/clusters o (Using term “block” for simplicity) • Bit vector or bit map (n blocks) … 0 1 2 n-1 bit[i] = 1  block[i] free 0  block[i] occupied Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit CPUs have instructions to return offset within word of first “1” bit
  • 21. (Cont.) • Bit map requires extra space o Example: block size = 4KB = 212 bytes disk size = 240 bytes (1 terabyte) n = 240/212 = 228 bits (or 256 MB) if clusters of 4 blocks -> 64MB of memory • Easy to get contiguous files • Linked list (free list) o Cannot get contiguous space easily o No waste of space o No need to traverse the entire list (if # free blocks recorded)
  • 22. Disk
  • 23. Free-Space Management (Cont.) • Grouping o Modify linked list to store address of next n-1 free blocks in first free block, plus a pointer to next block that contains free-block-pointers (like this one) • Counting o Because space is frequently contiguously used and freed, with contiguous- allocation allocation, extents, or clustering • Keep address of first free block and count of following free blocks • Free space list then has entries containing addresses and counts
  • 24. Free-Space Management (Cont.) • Space Maps o Used in ZFS o Consider meta-data I/O on very large file systems • Full data structures like bit maps couldn’t fit in memory -> thousands of I/Os o Divides device space into metaslab units and manages metaslabs • Given volume can contain hundreds of metaslabs o Each metaslab has associated space map • Uses counting algorithm o But records to log file rather than file system • Log of all block activity, in time order, in counting format o Metaslab activity -> load space map into memory in balanced-tree structure, indexed by offset • Replay log into that structure • Combine contiguous free blocks into single entry
  • 25. Performance • Efficiency dependent on: o Disk allocation and directory algorithms o Types of data kept in file’s directory entry o Pre-allocation or as-needed allocation of metadata structures o Fixed-size or varying-size data structures
  • 26. Performance (Cont.) • Performance o Keeping data and metadata close together o Buffer cache – separate section of main memory for frequently used blocks o Synchronous writes sometimes requested by apps or needed by OS • No buffering / caching – writes must hit disk before acknowledgement • Asynchronous writes more common, buffer-able, faster o Free-behind and read-ahead – techniques to optimize sequential access o Reads frequently slower than writes