SlideShare a Scribd company logo
Files and Data Storage
Files and Data Storage
● Most computers are used for data
processing, as a big growth area in the
“information age”
● Data processing from a computer science
perspective:
– Storage of data
– Organization of data
– Access to data
– Processing of data
Data Structures vs File Structures
• Both involve:
– Representation of Data
+
– Operations for accessing data
• Difference:
– Data structures: deal with data in the
main memory
– File structures: deal with the data in the
secondary storage
File Structure in Computer Science
Data Storage in Computer
Goal of the File Structures
● Minimize the number of trips to the
secondary storage (SS) in order to get
desired information.
● Group related information so that we are
likely to get everything we new with fewer
trip to the SS.
● Select the right file structures so that
performance can be increased.
File and File Operations
● A file is a collection of data stored on mass
storage like hard disk, CD etc.
● File data consist of records (student
information) and each record contains
number of fields (ID, Name etc.).
● We can perform following operations on a
file.
– Search for a particular data in a file.
– Add a certain data item.
– Remove / Update a certain item.
File and File operations
– Order the data items according to a
certain criterion, merge of files.
– Creation of new files from existing files.
– Finally create, open, and close
operations which have implications in the
operating system.
Organization of Files
● Sequential
● Indexed
● Hashing
Sequential File Organization
● Records are conceptually organized in a
sequential list and can only be accessed
sequentially.
● The actual storage might or might not be
sequential (on tape or on disk)
Sequential File (Write/Read in C++)
● Create ofstream object (after including file
fstream.h at the top)
● Open file for output or for appending at the
end of file.
● Test whether the file open operation of step
2 is successful. If not successful then exit
else continue.
● Write / Read data to output file.
● Close file after writing / reading data.
Sequential File Implementation
● #include <iostream.h>
● #include <fstream.h>
● #include <stdlib.h>
●
● Void main() {
● Int i, Roll[N] = { 171,717, 834, 394, 475 };
● float Percentage[N]= {45.3, 84.5, 95.0,
48.2, 39.2 };
● Char* Name[N] = {“wajid”, “Aashir”,
“Luqman”, “Tushar”, “Waseem” };
● // Step1: Create ofstream and ifstream
objects
● Ofstream outFile; ifstream inFile;
● // Step 2: Open file for output
● outFile.open(“percent.dat”, ios::out);
● // Step 3 Test weather open operation is
successful
● If (!outFile) {
– cout<<”File could not open “;
– Exit(1);
● Else
– Cout<<”n File open successfullyn”;
● //Step 4: Write to file
● For( i=0; i<N; i++)
– OutFile <<Name[i]<<' '<<Roll[i]<< ' '
<<Percentage[i]<<endl;
● cout<<”n File write successfully. n”;
● // Step 5: Close file
● outFile.close();
Sequential File Implementation
● // Step 6 open file for input
● inFile.open(“percentage.dat”, ios::in);
● // Step 7: Test wether file open successfully.
● if(!inFile) {
– cout<<”File could not open”<<endl;
– Exit(1);
● }
● // Step 8: Read from input File
● While( inFile>> Name >>Roll >> Percentage)
– cout<<setiosflags(ios::left)<<setw(14)<<roll <<setw(16)<<Name <<setw(9)<<Setprecision(4)
– <<setiosflags(ios::showpoint | ios:: right)
– <<percent<<'%'<< endl;
● //Step 9: Close file
● inFile.close(); }
Sequential File Implementation
● OUTPUT:
Roll Number Name Percentage
171 Wajid 45.30%
717 Aashir 84.50%
834 Luqman 95.00%
394 Tushar 48.20%
475 Waseem 39.20%
Indexed File Organization
● Sequential search is even slower on
disk/tape than in main memory. Try to
improve performance using more
sophisticated data structures.
● An index for a file is a list of key field values
occurring in the file along with the address
of the corresponding record in the mass
storage.
● Typically the key field is much smaller than
the entire record, so the index will fit in
main memory.
Indexed File Organization ...
● The index can be organized as a list, a
search tree, a hash table, etc. To find a
particular record:
● Search the index for the desired key.
● When the search returns the index entry,
extract the record’s address on mass
storage.
● Access the mass storage at the given
address to get the desired record.
Indexed File Organization ...
Hashed File Organization
● A hashed file uses a hash function to map
the key to the address.
● Eliminates the need for an extra file (index).
● There is no need for an index and all of the
overhead associated with it.
● Use an array of M < N linked lists, good
choice is M~ N/10
● Hash: map key to integer i between 0 and
M-1.
● Insert: put at front of ith chain (if not already
there).
● Search: only need to search ith chain.
Collusion Resolution (Separate Chaining)
Collusion Resolution (Separate Chaining)
Separate Chaining Implementation
Separate Chaining Implementation
● Use an array of size M >> N, good choice
M~2N
● Hash: map key to integer i between 0 and
M-1.
● Insert: put in slot i if free; if not try i+1, i+2,
etc.
● Search: search slot i; if occupied but no
match, try i+1, i+2, etc.
Collusion Resolution (Open Addressing)
Collusion Resolution (Open addressing)
Open Addressing Implementation

More Related Content

What's hot

Rdbms
RdbmsRdbms
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Arpee Callejo
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
Shubham Dwivedi
 
File system.
File system.File system.
File system.
elyza12
 
Dbms ppt
Dbms pptDbms ppt
Dbms ppt
Chinnu Shimna
 
File organization 1
File organization 1File organization 1
File organization 1
Rupali Rana
 
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
Siti Ismail
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage mediaSrinath Sri
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approach
Luina Pani
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
Meghaj Mallick
 
Data Analysis with Python Pandas
Data Analysis with Python PandasData Analysis with Python Pandas
Data Analysis with Python Pandas
Neeru Mittal
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceAnuj Modi
 
File Organization
File OrganizationFile Organization
File OrganizationManyi Man
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating systemtittuajay
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Disk management
Disk managementDisk management
Disk management
Agnas Jasmine
 
Database security issues
Database security issuesDatabase security issues
Database security issues
n|u - The Open Security Community
 

What's hot (20)

Rdbms
RdbmsRdbms
Rdbms
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
File system.
File system.File system.
File system.
 
Dbms ppt
Dbms pptDbms ppt
Dbms ppt
 
File organization 1
File organization 1File organization 1
File organization 1
 
Introduction to Database
Introduction to DatabaseIntroduction to Database
Introduction to Database
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage media
 
Data models
Data modelsData models
Data models
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approach
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
Data Analysis with Python Pandas
Data Analysis with Python PandasData Analysis with Python Pandas
Data Analysis with Python Pandas
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
 
trigger dbms
trigger dbmstrigger dbms
trigger dbms
 
File Organization
File OrganizationFile Organization
File Organization
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
File organization
File organizationFile organization
File organization
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
 
Disk management
Disk managementDisk management
Disk management
 
Database security issues
Database security issuesDatabase security issues
Database security issues
 

Viewers also liked

Data Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and ArchiveData Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and Archive
Amazon Web Services
 
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
Editor IJCATR
 
Csci12 report aug18
Csci12 report aug18Csci12 report aug18
Csci12 report aug18
karenostil
 
Fileorganization AbnMagdy
Fileorganization AbnMagdyFileorganization AbnMagdy
Fileorganization AbnMagdyMohamed Magdy
 
Cloud Computing through FCAPS Managed Services in a Virtualized Data Center
Cloud Computing through FCAPS Managed Services in a Virtualized Data CenterCloud Computing through FCAPS Managed Services in a Virtualized Data Center
Cloud Computing through FCAPS Managed Services in a Virtualized Data Center
vsarathy
 
external sorting
external sortingexternal sorting
external sorting
Jothi Lakshmi
 
Database, data storage, hosting with Firebase
Database, data storage, hosting with FirebaseDatabase, data storage, hosting with Firebase
Database, data storage, hosting with Firebase
Tu Pham
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data StructureAnuj Modi
 
File Management
File ManagementFile Management
File Management
Ramasubbu .P
 

Viewers also liked (11)

Data Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and ArchiveData Storage for the Long Haul: Compliance and Archive
Data Storage for the Long Haul: Compliance and Archive
 
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
AN INVERTED LIST BASED APPROACH TO GENERATE OPTIMISED PATH IN DSR IN MANETS –...
 
Csci12 report aug18
Csci12 report aug18Csci12 report aug18
Csci12 report aug18
 
Fileorganization AbnMagdy
Fileorganization AbnMagdyFileorganization AbnMagdy
Fileorganization AbnMagdy
 
Cloud Computing through FCAPS Managed Services in a Virtualized Data Center
Cloud Computing through FCAPS Managed Services in a Virtualized Data CenterCloud Computing through FCAPS Managed Services in a Virtualized Data Center
Cloud Computing through FCAPS Managed Services in a Virtualized Data Center
 
external sorting
external sortingexternal sorting
external sorting
 
Database, data storage, hosting with Firebase
Database, data storage, hosting with FirebaseDatabase, data storage, hosting with Firebase
Database, data storage, hosting with Firebase
 
File organisation
File organisationFile organisation
File organisation
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 
File Management
File ManagementFile Management
File Management
 
File organization
File organizationFile organization
File organization
 

Similar to Files and data storage

Linux and windows file system
Linux and windows  file systemLinux and windows  file system
Linux and windows file system
lin yucheng
 
DBMS-Unit5-PPT.pptx important for revision
DBMS-Unit5-PPT.pptx important for revisionDBMS-Unit5-PPT.pptx important for revision
DBMS-Unit5-PPT.pptx important for revision
yuvivarmaa
 
File Handling Btech computer science and engineering ppt
File Handling Btech computer science and engineering pptFile Handling Btech computer science and engineering ppt
File Handling Btech computer science and engineering ppt
pinuadarsh04
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
Abdul mannan Karim
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))
Papu Kumar
 
File Structure.pptx
File Structure.pptxFile Structure.pptx
File Structure.pptx
zedd15
 
File handling & basic operation on file in python
File handling & basic operation on file in pythonFile handling & basic operation on file in python
File handling & basic operation on file in python
ishantjaiswal2004
 
Data Structure Ppt for our engineering college industrial training.
Data Structure Ppt  for our engineering college industrial training.Data Structure Ppt  for our engineering college industrial training.
Data Structure Ppt for our engineering college industrial training.
AnumaiAshish
 
How to design a file system
How to design a file systemHow to design a file system
How to design a file system
Nikhil Anurag VN
 
ch11_fileInterface.pdf
ch11_fileInterface.pdfch11_fileInterface.pdf
ch11_fileInterface.pdf
HoNguyn746501
 
Lecture 8 comp forensics 03 10-18 file system
Lecture 8 comp forensics 03 10-18 file systemLecture 8 comp forensics 03 10-18 file system
Lecture 8 comp forensics 03 10-18 file system
Alchemist095
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMS
VrushaliSolanke
 
fileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdffileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdf
FraolUmeta
 
Physical Database Design for database student-1.pdf
Physical Database Design for database student-1.pdfPhysical Database Design for database student-1.pdf
Physical Database Design for database student-1.pdf
Bolando
 
oslectureset7.pdf
oslectureset7.pdfoslectureset7.pdf
oslectureset7.pdf
WaltonJrSmithTZ
 
Assets, files, and data parsing
Assets, files, and data parsingAssets, files, and data parsing
Assets, files, and data parsing
Aly Arman
 
Presentation of file handling in C language
Presentation of file handling in C languagePresentation of file handling in C language
Presentation of file handling in C language
Shruthi48
 
Reading and Writing Files
Reading and Writing FilesReading and Writing Files
Reading and Writing Files
primeteacher32
 
File organisation in system analysis and design
File organisation in system analysis and designFile organisation in system analysis and design
File organisation in system analysis and design
Mohitgauri
 

Similar to Files and data storage (20)

Linux and windows file system
Linux and windows  file systemLinux and windows  file system
Linux and windows file system
 
DBMS-Unit5-PPT.pptx important for revision
DBMS-Unit5-PPT.pptx important for revisionDBMS-Unit5-PPT.pptx important for revision
DBMS-Unit5-PPT.pptx important for revision
 
File Handling Btech computer science and engineering ppt
File Handling Btech computer science and engineering pptFile Handling Btech computer science and engineering ppt
File Handling Btech computer science and engineering ppt
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))
 
File Structure.pptx
File Structure.pptxFile Structure.pptx
File Structure.pptx
 
File handling & basic operation on file in python
File handling & basic operation on file in pythonFile handling & basic operation on file in python
File handling & basic operation on file in python
 
Data Structure Ppt for our engineering college industrial training.
Data Structure Ppt  for our engineering college industrial training.Data Structure Ppt  for our engineering college industrial training.
Data Structure Ppt for our engineering college industrial training.
 
How to design a file system
How to design a file systemHow to design a file system
How to design a file system
 
ch11_fileInterface.pdf
ch11_fileInterface.pdfch11_fileInterface.pdf
ch11_fileInterface.pdf
 
File handling in c++
File handling in c++File handling in c++
File handling in c++
 
Lecture 8 comp forensics 03 10-18 file system
Lecture 8 comp forensics 03 10-18 file systemLecture 8 comp forensics 03 10-18 file system
Lecture 8 comp forensics 03 10-18 file system
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMS
 
fileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdffileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdf
 
Physical Database Design for database student-1.pdf
Physical Database Design for database student-1.pdfPhysical Database Design for database student-1.pdf
Physical Database Design for database student-1.pdf
 
oslectureset7.pdf
oslectureset7.pdfoslectureset7.pdf
oslectureset7.pdf
 
Assets, files, and data parsing
Assets, files, and data parsingAssets, files, and data parsing
Assets, files, and data parsing
 
Presentation of file handling in C language
Presentation of file handling in C languagePresentation of file handling in C language
Presentation of file handling in C language
 
Reading and Writing Files
Reading and Writing FilesReading and Writing Files
Reading and Writing Files
 
File organisation in system analysis and design
File organisation in system analysis and designFile organisation in system analysis and design
File organisation in system analysis and design
 

More from Zaid Shabbir

Modern SDLC and QA.pptx
Modern SDLC and QA.pptxModern SDLC and QA.pptx
Modern SDLC and QA.pptx
Zaid Shabbir
 
Software Agility.pptx
Software Agility.pptxSoftware Agility.pptx
Software Agility.pptx
Zaid Shabbir
 
Software Development Guide To Accelerate Performance
Software Development Guide To Accelerate PerformanceSoftware Development Guide To Accelerate Performance
Software Development Guide To Accelerate Performance
Zaid Shabbir
 
Software Testing and Agility
Software Testing and Agility Software Testing and Agility
Software Testing and Agility
Zaid Shabbir
 
Data security and Integrity
Data security and IntegrityData security and Integrity
Data security and Integrity
Zaid Shabbir
 
Cloud computing &amp; dbms
Cloud computing &amp; dbmsCloud computing &amp; dbms
Cloud computing &amp; dbms
Zaid Shabbir
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresql
Zaid Shabbir
 
Queue
QueueQueue
Queue
QueueQueue
Stack
StackStack
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
Zaid Shabbir
 
Sorting
SortingSorting
Sorting
Zaid Shabbir
 

More from Zaid Shabbir (13)

Modern SDLC and QA.pptx
Modern SDLC and QA.pptxModern SDLC and QA.pptx
Modern SDLC and QA.pptx
 
Software Agility.pptx
Software Agility.pptxSoftware Agility.pptx
Software Agility.pptx
 
Software Development Guide To Accelerate Performance
Software Development Guide To Accelerate PerformanceSoftware Development Guide To Accelerate Performance
Software Development Guide To Accelerate Performance
 
Software Testing and Agility
Software Testing and Agility Software Testing and Agility
Software Testing and Agility
 
Data security and Integrity
Data security and IntegrityData security and Integrity
Data security and Integrity
 
Cloud computing &amp; dbms
Cloud computing &amp; dbmsCloud computing &amp; dbms
Cloud computing &amp; dbms
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresql
 
Queue
QueueQueue
Queue
 
Queue
QueueQueue
Queue
 
Sorting
SortingSorting
Sorting
 
Stack
StackStack
Stack
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
 
Sorting
SortingSorting
Sorting
 

Recently uploaded

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

Files and data storage

  • 1. Files and Data Storage
  • 2. Files and Data Storage ● Most computers are used for data processing, as a big growth area in the “information age” ● Data processing from a computer science perspective: – Storage of data – Organization of data – Access to data – Processing of data
  • 3. Data Structures vs File Structures • Both involve: – Representation of Data + – Operations for accessing data • Difference: – Data structures: deal with data in the main memory – File structures: deal with the data in the secondary storage
  • 4. File Structure in Computer Science
  • 5. Data Storage in Computer
  • 6. Goal of the File Structures ● Minimize the number of trips to the secondary storage (SS) in order to get desired information. ● Group related information so that we are likely to get everything we new with fewer trip to the SS. ● Select the right file structures so that performance can be increased.
  • 7. File and File Operations ● A file is a collection of data stored on mass storage like hard disk, CD etc. ● File data consist of records (student information) and each record contains number of fields (ID, Name etc.). ● We can perform following operations on a file. – Search for a particular data in a file. – Add a certain data item. – Remove / Update a certain item.
  • 8. File and File operations – Order the data items according to a certain criterion, merge of files. – Creation of new files from existing files. – Finally create, open, and close operations which have implications in the operating system.
  • 9. Organization of Files ● Sequential ● Indexed ● Hashing
  • 10. Sequential File Organization ● Records are conceptually organized in a sequential list and can only be accessed sequentially. ● The actual storage might or might not be sequential (on tape or on disk)
  • 11. Sequential File (Write/Read in C++) ● Create ofstream object (after including file fstream.h at the top) ● Open file for output or for appending at the end of file. ● Test whether the file open operation of step 2 is successful. If not successful then exit else continue. ● Write / Read data to output file. ● Close file after writing / reading data.
  • 12. Sequential File Implementation ● #include <iostream.h> ● #include <fstream.h> ● #include <stdlib.h> ● ● Void main() { ● Int i, Roll[N] = { 171,717, 834, 394, 475 }; ● float Percentage[N]= {45.3, 84.5, 95.0, 48.2, 39.2 }; ● Char* Name[N] = {“wajid”, “Aashir”, “Luqman”, “Tushar”, “Waseem” }; ● // Step1: Create ofstream and ifstream objects ● Ofstream outFile; ifstream inFile; ● // Step 2: Open file for output ● outFile.open(“percent.dat”, ios::out); ● // Step 3 Test weather open operation is successful ● If (!outFile) { – cout<<”File could not open “; – Exit(1); ● Else – Cout<<”n File open successfullyn”; ● //Step 4: Write to file ● For( i=0; i<N; i++) – OutFile <<Name[i]<<' '<<Roll[i]<< ' ' <<Percentage[i]<<endl; ● cout<<”n File write successfully. n”; ● // Step 5: Close file ● outFile.close();
  • 13. Sequential File Implementation ● // Step 6 open file for input ● inFile.open(“percentage.dat”, ios::in); ● // Step 7: Test wether file open successfully. ● if(!inFile) { – cout<<”File could not open”<<endl; – Exit(1); ● } ● // Step 8: Read from input File ● While( inFile>> Name >>Roll >> Percentage) – cout<<setiosflags(ios::left)<<setw(14)<<roll <<setw(16)<<Name <<setw(9)<<Setprecision(4) – <<setiosflags(ios::showpoint | ios:: right) – <<percent<<'%'<< endl; ● //Step 9: Close file ● inFile.close(); }
  • 14. Sequential File Implementation ● OUTPUT: Roll Number Name Percentage 171 Wajid 45.30% 717 Aashir 84.50% 834 Luqman 95.00% 394 Tushar 48.20% 475 Waseem 39.20%
  • 15. Indexed File Organization ● Sequential search is even slower on disk/tape than in main memory. Try to improve performance using more sophisticated data structures. ● An index for a file is a list of key field values occurring in the file along with the address of the corresponding record in the mass storage. ● Typically the key field is much smaller than the entire record, so the index will fit in main memory.
  • 16. Indexed File Organization ... ● The index can be organized as a list, a search tree, a hash table, etc. To find a particular record: ● Search the index for the desired key. ● When the search returns the index entry, extract the record’s address on mass storage. ● Access the mass storage at the given address to get the desired record.
  • 18. Hashed File Organization ● A hashed file uses a hash function to map the key to the address. ● Eliminates the need for an extra file (index). ● There is no need for an index and all of the overhead associated with it.
  • 19. ● Use an array of M < N linked lists, good choice is M~ N/10 ● Hash: map key to integer i between 0 and M-1. ● Insert: put at front of ith chain (if not already there). ● Search: only need to search ith chain. Collusion Resolution (Separate Chaining)
  • 23. ● Use an array of size M >> N, good choice M~2N ● Hash: map key to integer i between 0 and M-1. ● Insert: put in slot i if free; if not try i+1, i+2, etc. ● Search: search slot i; if occupied but no match, try i+1, i+2, etc. Collusion Resolution (Open Addressing)