SlideShare a Scribd company logo
1 of 9
Consider a file currently consisting of 100 blocks. Assume that the file- control
block (and the index block, in the case of indexed allocation) is already in memory.
Calculate how many disk I/O operations are required for contiguous, linked, and
indexed (single-level) allocation strategies, if, for one block, the following
conditions hold:
a) The block is added at the beginning.
b) The block is added in the middle.
c) The block is added at the end.
d) The block is removed from the beginning.
e) The block is removed from the middle.
f) The block is removed from the end.
Note: In the contiguous-allocation case, assume that there is no room to grow at
the beginning but there is room to grow at the end. Also assume that the block
information to be added is stored in memory.
Assumptions for the solution:
• In contiguous allocation, the length of the file (in blocks) and the pointer to
the first block is stored in memory.
• The linked allocation method has a pointer to the head and a pointer to the
tail block stored in memory. Each block only has a pointer to the next block
and not a pointer to the previous block.
• In indexed allocation method, the index is completely in memory.
a) The block is added at the beginning.
• Contiguous allocation method: 201
Each block must be shifted over to the next block, which involves one
read and one write per block. Then the new block must be written.
• Linked allocation method: 1
The new block is written, making it point to the next block. Then the
first block pointer in memory is updated.
• Indexed allocation method: 1
The new block is written and the index in memory is updated.
b) The block is added in the middle.
• Contiguous allocation method: 101
The second half, consisting of 50 blocks, must be shifted over one
block and the new block must be written. As before, the shift takes one read
operation and one write operation.
• Linked allocation method: 52
To position to the middle, 50 blocks must be read. Afterwards, one write is
needed to make the new node to point to the previously 51st block. Another
write is needed to write the 50th block to point to the new block.
• Indexed allocation method: 1
The new block is written and the index in memory is updated.
c) The block is added at the end.
• Contiguous allocation method: 1
Just write the new block.
• Linked allocation method: 3
First, the last block, given by the last block pointer, needs to be read. Then the new
block is written. Next, the previously read last block is written back with modified next
block pointer to point to the new block. In the end, the last block pointer is updated in
memory.
• Indexed allocation method: 1
The new block is written and the index in memory is updated.
The new block is written, making it point to the next block. Update the first block pointer in
memory.
d) The block is removed from the beginning.
• Contiguous allocation method: 0 or 198
0: Just make the pointer from the directory entry to point to the second
block.
198: Move all the blocks from the second block to the end one block over,
which requires 99 read and 99 write operations.
• Linked allocation method: 1
The first block must be read in order to get to the second block’s pointer and
then the pointer from the directory entry must be updated to point to the
second block.
• Indexed allocation method: 0
Remove the block from the index in memory.
e) The block is removed from the middle.
• Contiguous allocation method: 98
To remove the 51st block, 49 blocks need to be moved one block over which
takes a read and a write operation each.
• Linked allocation method: 52
To find the pointer to the 52 block, 51 reads are necessary. Then the 50th
block’s next pointer is updated with this value.
• Indexed allocation method: 0
The block is removed from the index in memory.
f) The block is removed from the end.
• Contiguous allocation method: 0
Update the length information stored in memory.
• Linked allocation method: 100
The tail block pointer needs to be updated to point to the second to the last
block and the only way to get the second to last block is to read the
preceding 99 blocks. Then the 99th block next pointer needs to be updated
to a null pointer. The tail block in memory is updated.
• Indexed allocation method: 0
The block is removed from the index in memory.

More Related Content

More from Senthil Vit

Virtualization.pptx
Virtualization.pptxVirtualization.pptx
Virtualization.pptxSenthil Vit
 
Traffic-Monitoring.ppt
Traffic-Monitoring.pptTraffic-Monitoring.ppt
Traffic-Monitoring.pptSenthil Vit
 
ALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBSenthil Vit
 

More from Senthil Vit (6)

Virtualization.pptx
Virtualization.pptxVirtualization.pptx
Virtualization.pptx
 
Traffic-Monitoring.ppt
Traffic-Monitoring.pptTraffic-Monitoring.ppt
Traffic-Monitoring.ppt
 
Lect_2.pptx
Lect_2.pptxLect_2.pptx
Lect_2.pptx
 
6. Deadlock.ppt
6. Deadlock.ppt6. Deadlock.ppt
6. Deadlock.ppt
 
os4-2_cop.ppt
os4-2_cop.pptos4-2_cop.ppt
os4-2_cop.ppt
 
ALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROBALPHA_BETA_EXAMPLE_PROB
ALPHA_BETA_EXAMPLE_PROB
 

Recently uploaded

Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligencemahaffeycheryld
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdfVinayVadlagattu
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Christo Ananth
 
Dynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptxDynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptxMustafa Ahmed
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...Amil baba
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...AshwaniAnuragi1
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfJNTUA
 
Databricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfDatabricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfVinayVadlagattu
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfEr.Sonali Nasikkar
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...IJECEIAES
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Studentskannan348865
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 

Recently uploaded (20)

Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
Databricks Generative AI Fundamentals .pdf
Databricks Generative AI Fundamentals  .pdfDatabricks Generative AI Fundamentals  .pdf
Databricks Generative AI Fundamentals .pdf
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
 
Dynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptxDynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptx
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
01-vogelsanger-stanag-4178-ed-2-the-new-nato-standard-for-nitrocellulose-test...
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdf
 
Databricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdfDatabricks Generative AI FoundationCertified.pdf
Databricks Generative AI FoundationCertified.pdf
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Students
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 

File Implementation Problem.pptx

  • 1.
  • 2. Consider a file currently consisting of 100 blocks. Assume that the file- control block (and the index block, in the case of indexed allocation) is already in memory. Calculate how many disk I/O operations are required for contiguous, linked, and indexed (single-level) allocation strategies, if, for one block, the following conditions hold: a) The block is added at the beginning. b) The block is added in the middle. c) The block is added at the end. d) The block is removed from the beginning. e) The block is removed from the middle. f) The block is removed from the end. Note: In the contiguous-allocation case, assume that there is no room to grow at the beginning but there is room to grow at the end. Also assume that the block information to be added is stored in memory.
  • 3. Assumptions for the solution: • In contiguous allocation, the length of the file (in blocks) and the pointer to the first block is stored in memory. • The linked allocation method has a pointer to the head and a pointer to the tail block stored in memory. Each block only has a pointer to the next block and not a pointer to the previous block. • In indexed allocation method, the index is completely in memory.
  • 4. a) The block is added at the beginning. • Contiguous allocation method: 201 Each block must be shifted over to the next block, which involves one read and one write per block. Then the new block must be written. • Linked allocation method: 1 The new block is written, making it point to the next block. Then the first block pointer in memory is updated. • Indexed allocation method: 1 The new block is written and the index in memory is updated.
  • 5. b) The block is added in the middle. • Contiguous allocation method: 101 The second half, consisting of 50 blocks, must be shifted over one block and the new block must be written. As before, the shift takes one read operation and one write operation. • Linked allocation method: 52 To position to the middle, 50 blocks must be read. Afterwards, one write is needed to make the new node to point to the previously 51st block. Another write is needed to write the 50th block to point to the new block. • Indexed allocation method: 1 The new block is written and the index in memory is updated.
  • 6. c) The block is added at the end. • Contiguous allocation method: 1 Just write the new block. • Linked allocation method: 3 First, the last block, given by the last block pointer, needs to be read. Then the new block is written. Next, the previously read last block is written back with modified next block pointer to point to the new block. In the end, the last block pointer is updated in memory. • Indexed allocation method: 1 The new block is written and the index in memory is updated. The new block is written, making it point to the next block. Update the first block pointer in memory.
  • 7. d) The block is removed from the beginning. • Contiguous allocation method: 0 or 198 0: Just make the pointer from the directory entry to point to the second block. 198: Move all the blocks from the second block to the end one block over, which requires 99 read and 99 write operations. • Linked allocation method: 1 The first block must be read in order to get to the second block’s pointer and then the pointer from the directory entry must be updated to point to the second block. • Indexed allocation method: 0 Remove the block from the index in memory.
  • 8. e) The block is removed from the middle. • Contiguous allocation method: 98 To remove the 51st block, 49 blocks need to be moved one block over which takes a read and a write operation each. • Linked allocation method: 52 To find the pointer to the 52 block, 51 reads are necessary. Then the 50th block’s next pointer is updated with this value. • Indexed allocation method: 0 The block is removed from the index in memory.
  • 9. f) The block is removed from the end. • Contiguous allocation method: 0 Update the length information stored in memory. • Linked allocation method: 100 The tail block pointer needs to be updated to point to the second to the last block and the only way to get the second to last block is to read the preceding 99 blocks. Then the 99th block next pointer needs to be updated to a null pointer. The tail block in memory is updated. • Indexed allocation method: 0 The block is removed from the index in memory.