0% found this document useful (0 votes)
57 views4 pages

Aim: To Study Implementation of File Allocation Strategies (Indexed) - Theory

The document describes an experiment to study the implementation of an indexed file allocation strategy. The indexed strategy uses an index block for each file that contains pointers to the file's data blocks, allowing direct access. This supports fast access to file blocks and avoids external fragmentation. The program implements sequential searching of a text file to check if a given word is present and outputs the word if found. In conclusion, the sequential file allocation method was successfully studied and implemented.

Uploaded by

Romeo Jatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views4 pages

Aim: To Study Implementation of File Allocation Strategies (Indexed) - Theory

The document describes an experiment to study the implementation of an indexed file allocation strategy. The indexed strategy uses an index block for each file that contains pointers to the file's data blocks, allowing direct access. This supports fast access to file blocks and avoids external fragmentation. The program implements sequential searching of a text file to check if a given word is present and outputs the word if found. In conclusion, the sequential file allocation method was successfully studied and implemented.

Uploaded by

Romeo Jatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment:

Aim: To study implementation of file allocation strategies(Indexed).


Theory:
In this scheme, a special block known as the Index block contains the pointers to all the
blocks occupied by a file. Each file has its own index block. The ith entry in the index block
contains the disk address of the ith file block. The directory entry contains the address of the
index block as shown in the image:

Advantages:
 This supports direct access to the blocks occupied by the file and therefore provides
fast access to the file blocks.
 It overcomes the problem of external fragmentation.

Program:
#include <iostream>
#include <iomanip>
#include <fstream>
#include<string>
using namespace std;
int main() {
int sum = 0;
string x;
ifstream inFile;

inFile.open("test.txt");
if (!inFile) {
cout << "Unable to open file";
exit(1);
}
string s = "failure";
int flag = 0;
string t;
cout<<"Enter index";
cin>>t;
while (inFile >> x) {
if(flag){
cout<<"Word found :"<<x<<" ";
flag = 0;
}

if(x == t){

flag = 1;
}

}
inFile.close();

return 0;
}
Output:

Conclusion:
Sequential file allocation method studied successfully and implemented.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy