SlideShare ist ein Scribd-Unternehmen logo
1 von 13
PRIMARY
STORAGE
SECONDARY
STORAGE
1)Faster Access Slower Access
2)Expensive Cheaper
3)Lesser storage
capacity
Greater Storage
capacity
4)Temporary Storage Permanent Storage
 Secondary Storage Structure
 Used for permanent storage
 It’s a collection of records or a stream of bytes
 Every Record is a collection of fields
 A particular field is chosen as a Key
 Records are organised in file by using the key. Primary
and secondary keys.
 Consider a student database.
 Every student has a unique record
 Record has details of student-i.e name, Student
ID etc. These are the fields.
 The unique key can be the Student ID. The
records can be organised in the file on basis of
student ID.
 Sometimes data is too large to be stored in main
memory.
 Maintaining permanent record is possible only by
using a secondary storage. Hence files.
 Physical Files:
A collection of bits stored in the secondary storage
device
 Logical File:
A channel that connects he program to the physical
file(Stream).
An example
FILE* out
out=fopen(“sample.txt”,”w”);
Here out is the logical file and sample.txt is the
physical file.
 Opening a File:
A logical file is associated with the physical file
 Closing a File:
The logical file associated with the physical file is freed.
fclose(file pointer);
 Reading from file:
Data present in physical file is read by using the logical file
 Writing to a File
Data can be written to physical file by using the logical file
 Every logical file has a file position pointer.
 When we open a new stream the position pointer
is set to beginning of the file.
 As data is read or written the file position pointer is
moved accordingly.
 To move file pointer to required position.
fseek(file pointer,offset, position); 
 To display current location of pointer.
long position=ftell(pointer);
 To check for end of file
while(!feof(pointer));
 Sequential File
Stored in the order entered
 Random Access Files
An record is accessed using an index.(Hashing).
 Direct Access Files:
The records are stored based on their relative
position with respect to first record.
Record with key 50 is placed at location 50
 Records are stored in the order entered
 Used when all the records have to be processed.
 Complexity for searching O(n)
 An record is accessed using an index.
 The index of record position in file has to be
maintained in the main memory.
 The Index can be created using hashing.
 Search complexity is less. Complexity of Indexing
method used.
 Disadvantage: While handling very large
databases its not possible to maintain an index in
the main memory.
 The records are stored based on their relative
position with respect to first record.
 Record with key 50 is placed at location 50
 The search complexity is O(1)
 Disadvantage is a lot of memory is wasted.
 For example if no record has key 100 the position
100 is wasted.

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Unit 4 external sorting
Unit 4   external sortingUnit 4   external sorting
Unit 4 external sorting
 
Data structures
Data structuresData structures
Data structures
 
Memory management
Memory managementMemory management
Memory management
 
DBMS: Types of keys
DBMS:  Types of keysDBMS:  Types of keys
DBMS: Types of keys
 
2 phase locking protocol DBMS
2 phase locking protocol DBMS2 phase locking protocol DBMS
2 phase locking protocol DBMS
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
File organization
File organizationFile organization
File organization
 
Memory management
Memory managementMemory management
Memory management
 
Chapter 14 - Protection
Chapter 14 - ProtectionChapter 14 - Protection
Chapter 14 - Protection
 
File organization
File organizationFile organization
File organization
 
Swap-space Management
Swap-space ManagementSwap-space Management
Swap-space Management
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
File access methods.54
File access methods.54File access methods.54
File access methods.54
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
File organization
File organizationFile organization
File organization
 
Double Hashing.pptx
Double Hashing.pptxDouble Hashing.pptx
Double Hashing.pptx
 
Isam
IsamIsam
Isam
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 

Ähnlich wie File structures

Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systemsdonny101
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingZainab Almugbel
 
File handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptxFile handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptxarmaansohail9356
 
text and binary sequential and random files with modes
text and binary sequential and random files with modestext and binary sequential and random files with modes
text and binary sequential and random files with modesAnimecartoon1
 
Learn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptLearn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptgeethasenthil2706
 
Introduction to File System
Introduction to File SystemIntroduction to File System
Introduction to File SystemSanthiNivas
 
FIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxFIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxAshwini Raut
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing OperationsRico
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing OperationsDon Bosco BSIT
 
presentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.pptpresentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.pptansariparveen06
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file managementKalai Selvi
 
File Types in Data Structure
File Types in Data StructureFile Types in Data Structure
File Types in Data StructureProf Ansari
 

Ähnlich wie File structures (20)

Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
 
FILES IN C
FILES IN CFILES IN C
FILES IN C
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashing
 
File Systems
File SystemsFile Systems
File Systems
 
File management
File managementFile management
File management
 
File handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptxFile handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptx
 
text and binary sequential and random files with modes
text and binary sequential and random files with modestext and binary sequential and random files with modes
text and binary sequential and random files with modes
 
Learn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptLearn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems ppt
 
Introduction to File System
Introduction to File SystemIntroduction to File System
Introduction to File System
 
File Handling in C
File Handling in CFile Handling in C
File Handling in C
 
pspp-rsk.pptx
pspp-rsk.pptxpspp-rsk.pptx
pspp-rsk.pptx
 
FIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxFIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptx
 
Unit-VI.pptx
Unit-VI.pptxUnit-VI.pptx
Unit-VI.pptx
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing Operations
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing Operations
 
presentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.pptpresentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.ppt
 
files in c ppt.ppt
files in c ppt.pptfiles in c ppt.ppt
files in c ppt.ppt
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
File Types in Data Structure
File Types in Data StructureFile Types in Data Structure
File Types in Data Structure
 

Kürzlich hochgeladen

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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Kürzlich hochgeladen (20)

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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

File structures

  • 1.
  • 2. PRIMARY STORAGE SECONDARY STORAGE 1)Faster Access Slower Access 2)Expensive Cheaper 3)Lesser storage capacity Greater Storage capacity 4)Temporary Storage Permanent Storage
  • 3.  Secondary Storage Structure  Used for permanent storage  It’s a collection of records or a stream of bytes  Every Record is a collection of fields  A particular field is chosen as a Key  Records are organised in file by using the key. Primary and secondary keys.
  • 4.  Consider a student database.  Every student has a unique record  Record has details of student-i.e name, Student ID etc. These are the fields.  The unique key can be the Student ID. The records can be organised in the file on basis of student ID.
  • 5.  Sometimes data is too large to be stored in main memory.  Maintaining permanent record is possible only by using a secondary storage. Hence files.
  • 6.  Physical Files: A collection of bits stored in the secondary storage device  Logical File: A channel that connects he program to the physical file(Stream). An example FILE* out out=fopen(“sample.txt”,”w”); Here out is the logical file and sample.txt is the physical file.
  • 7.  Opening a File: A logical file is associated with the physical file  Closing a File: The logical file associated with the physical file is freed. fclose(file pointer);  Reading from file: Data present in physical file is read by using the logical file  Writing to a File Data can be written to physical file by using the logical file
  • 8.  Every logical file has a file position pointer.  When we open a new stream the position pointer is set to beginning of the file.  As data is read or written the file position pointer is moved accordingly.
  • 9.  To move file pointer to required position. fseek(file pointer,offset, position);   To display current location of pointer. long position=ftell(pointer);  To check for end of file while(!feof(pointer));
  • 10.  Sequential File Stored in the order entered  Random Access Files An record is accessed using an index.(Hashing).  Direct Access Files: The records are stored based on their relative position with respect to first record. Record with key 50 is placed at location 50
  • 11.  Records are stored in the order entered  Used when all the records have to be processed.  Complexity for searching O(n)
  • 12.  An record is accessed using an index.  The index of record position in file has to be maintained in the main memory.  The Index can be created using hashing.  Search complexity is less. Complexity of Indexing method used.  Disadvantage: While handling very large databases its not possible to maintain an index in the main memory.
  • 13.  The records are stored based on their relative position with respect to first record.  Record with key 50 is placed at location 50  The search complexity is O(1)  Disadvantage is a lot of memory is wasted.  For example if no record has key 100 the position 100 is wasted.