SlideShare a Scribd company logo
Database Management
Systems (ITEC-212)
UNIT 1 - STORAGE SYSTEM AND FILE STRUCTURE
Unit Overview
◦ Storage System
◦ Types of Memory
◦ Spanned and un-spanned records
◦ RAID and its types
◦ File Structure
◦ File Organization and its types
◦ File Operations
Storage System
Databases are stored in file formats, which contain records. At physical level, the actual data is
stored in electromagnetic format on some device. These storage devices can be broadly
categorized into three types:
Categories of Storage Devices
Primary Storage: The memory storage that is directly accessible to the CPU comes under this
category. CPU's internal memory (registers), fast memory (cache), and main memory (RAM) are
directly accessible to the CPU, as they are all placed on the motherboard or CPU chipset. This
storage is typically very small, ultra-fast, and volatile. Primary storage requires continuous
power supply in order to maintain its state. In case of a power failure, all its data is lost.
Secondary Storage: Secondary storage devices are used to store data for future use or as
backup. Secondary storage includes memory devices that are not a part of the CPU chipset or
motherboard, for example hard disks, SSD, flash drive/USB drive.
Tertiary Storage: Tertiary storage is a type of secondary storage that is mainly used to store
huge volumes of data. Since such storage devices are external to the computer system, they are
the slowest in speed. These storage devices are mostly used to take the back up of an entire
system. For example magnetic tapes has been widely used as tertiary storage where as cloud
storage and network-attached storage (NAS) are the recent trends in tertiary storage.
Memory Hierarchy
A computer system has a well-defined hierarchy of memory.
A CPU has direct access to it main memory as well as its inbuilt registers. The access time of the
main memory is obviously less than the CPU speed.
To minimize the speed mismatch of CPU and main memory, cache memory is introduced.
Cache memory provides the fastest access time and it contains data that is most frequently
accessed by the CPU.
The memory with the fastest access is the costliest one. Larger storage devices offer slow speed
and they are less expensive, however they can store huge volumes of data as compared to CPU
registers or cache memory.
Memory Hierarchy Diagram
Comparison of Storage Types
Storage Type Speed Capacity Cost Durability Volatility
Cache
Very fast
(10-100 GB/s)
Very small
(1-32 MB)
Expensive
($10-100/MB) Low Yes
RAM
Fast
(5-40 GB/s)
Medium
(2-64 GB)
Moderate
($5-10/GB) Low Yes
USB
Fast
(10-200 MB/s)
Small
(4-256 GB)
Moderate
($0.5-1/GB) High No
SSD
Fast
(100-500 MB/s)
Large
(128 GB-4 TB)
Expensive
($10-100/MB ) High No
Magnetic disk
Moderate
(50-200 MB/s)
Large
(500 GB-10 TB)
Low
($0.02-0.05/GB) Low No
Optical storage
Slow
(5-50 MB/s)
Moderate
(700 MB-50 GB)
Low
($0.01-0.1/GB) Low No
Magnetic tape
Slow
(100-300 MB/s)
Large
(500 GB-30 TB)
Very low
($0.005-0.02/GB) Moderate No
Cache memory
◦ Cache memory is very fast and very small.
◦ It is used to store data that the CPU needs often.
◦ It is close to the CPU and has different levels.
◦ It is expensive and loses data when the power is off.
Random Access Memory
◦ RAM is fast and medium-sized.
◦ It is used to store data and programs that are
running on the computer.
◦ It is directly accessed by the CPU and has two
types: DRAM and SRAM.
◦ It is cheaper than cache memory but more
expensive than secondary memory.
◦ It also loses data when the power is off.
Universal Serial Bus memory
◦ USB memory is a small and portable device that uses
flash memory.
◦ It is used to store and transfer data between different
devices.
◦ It has no moving parts and uses less power.
◦ It is faster than secondary memory but slower than
RAM memory.
◦ It has limited capacity and write cycles.
◦ It can lose data if it is not properly ejected or
unplugged.
Solid State Drive
◦ SSD memory is a large and fast device that uses flash
memory.
◦ It is used to replace hard disk drives in computers and
laptops.
◦ It has no moving parts and uses less power.
◦ It is faster, quieter, and more reliable than hard disk
drives.
◦ However, it is more expensive, has limited write cycles,
and can lose data when the power is off.
Magnetic disk memory
◦ Magnetic disk memory is a large and moderate device that
uses magnetized materials.
◦ It is used to store large amounts of data that do not need
frequent access.
◦ It has rotating disks and moving parts.
◦ It uses more power and makes noise.
◦ It is prone to mechanical failures, data corruption, and
physical damage.
◦ It is cheaper than solid state memory but more expensive
than optical memory.
◦ A read/write head moves in between the disks and is used
to magnetize or de-magnetize the spot under it.
◦ A magnetized spot can be recognized as 0 (zero) or 1
(one).
Magnetic disk memory components
•A Platters is a round disc that can store data on both sides.
•A Heads is advice that can read and write data on the
platters.
•An actuator arms is a device that can move the heads across
the platters.
•A hard disk has rings of data called tracks that are divided
into small pieces called sectors. A sector on a hard disk typically
stores 512 bytes of data.
•The groups of sectors are called clusters that can store files
or parts of files.
•The sets of tracks on hard disk is called cylinders that are
formed by the movement of the heads.
•Formatting divides tracks into equal sized disk blocks. These
blocks are separated by interblock gaps
Spanned and un-spanned records
Spanned and un-spanned records are two ways of mapping file records into blocks of disk.
A file record is a unit of data that belongs to a file.
A block is a unit of storage on the disk.
Spanned Record Un-Spanned Record
A spanned record is a record that can be divided
into segments and stored in two or more
consecutive blocks.
An un-spanned record is a record that must be
stored in one block completely.
Optical disk memory
◦ Optical disk memory is a moderate and slow device that uses lasers.
◦ It is used to store data that need to be distributed or archived.
◦ It has reflective surfaces and moving parts.
◦ It is vulnerable to scratches, dust, and heat.
◦ It is less reliable and has shorter lifespan than magnetic and solid
state memory.
◦ It is cheaper than magnetic memory but more expensive than
magnetic tape memory.
◦ Pit and land are the two basic components of an optical disc's
surface.
◦ A pit is a small depression or hole in the disc's reflective layer, while a
land is a flat area.
◦ These variations in the disc's surface represent the digital
information stored on the disc.
Magnetic tape memory
◦ Magnetic tape memory is a large and slow device that
uses magnetized materials.
◦ It is used to store data backups and archives.
◦ It has thin plastic ribbons and moving parts.
◦ It is cheaper, has higher capacity, and has longer
lifespan than other types of memory.
◦ However, it is slower, has sequential access, and is
more prone to wear and tear.
◦ It is less convenient and less compatible than other
types of memory.
RAID
◦ RAID stands for Redundant Array of Independent Disks, which is a technology to connect
multiple secondary storage devices and use them as a single storage media.
◦ RAID consists of an array of disks in which multiple disks are connected together to achieve
different goals.
◦ RAID levels define the use of disk arrays.
RAID 0
◦ In this level, a striped array of disks is implemented.
◦ The data is broken down into blocks and the blocks are distributed among disks.
◦ Each disk receives a block of data to write/read in parallel.
◦ It enhances the speed and performance of the storage device.
◦ There is no parity and backup in Level 0.
RAID 1
◦ RAID 1 uses mirroring techniques.
◦ When data is sent to a RAID controller, it sends a copy of data to all the disks in the array.
◦ RAID level 1 is also called mirroring and provides 100% redundancy in case of a failure.
RAID 2
◦ RAID 2 records Error Correction Code using Hamming distance for its data, striped on
different disks.
◦ Like level 0, each data bit in a word is recorded on a separate disk and ECC codes of the data
words are stored on a different set disks.
◦ Due to its complex structure and high cost, RAID 2 is not commercially available.
RAID 3 (Self Study)
◦ RAID 3 stripes the data onto multiple disks.
◦ The parity bit generated for data word is stored on a different disk.
◦ This technique makes it to overcome single disk failures.
RAID 4 (Self Study)
◦ In this level, an entire block of data is written onto data disks and then the parity is generated
and stored on a different disk.
◦ Note that, level 3 uses byte-level striping, whereas level 4 uses block-level striping.
◦ Both level 3 and level 4 require at least three disks to implement RAID.
RAID 5 (Self Study)
RAID 5 writes whole data blocks onto different disks, but the parity bits generated for data
block stripe are distributed among all the data disks rather than storing them on a different
dedicated disk.
RAID 6 (Self Study)
◦ RAID 6 is an extension of level 5.
◦ In this level, two independent parities are generated and stored in distributed fashion among
multiple disks.
◦ Two parities provide additional fault tolerance. This level requires at least four disk drives to
implement RAID.
File Structure
File Structure: A file structure in DBMS refers to the organization and arrangement of data
within a file. It defines how data is stored, accessed, and retrieved from the file.
◦ A file is a sequence of records stored in binary format.
◦ A disk drive is formatted into several blocks that can store records.
◦ File records are mapped onto those disk blocks.
File Organization
File Organization defines how file records are mapped onto disk blocks. We have four types of
File Organization to organize file records:
Heap File Organization
◦ When a file is created using Heap File Organization,
the Operating System allocates memory area to that
file without any further accounting details.
◦ File records can be placed anywhere in that memory
area.
◦ It is the responsibility of the software to manage the
records.
◦ Heap File does not support any ordering, sequencing,
or indexing on its own.
Sequential File Organization
◦ Every file record contains a data field (attribute) to uniquely identify that record.
◦ In sequential file organization, records are placed in the file in some sequential order based
on the unique key field or search key.
◦ Practically, it is not possible to store all the records sequentially in physical form.
Hash File Organization
◦ Hash File Organization uses Hash function
computation on some fields of the records.
◦ The output of the hash function determines
the location of disk block where the records
are to be placed.
Clustered File Organization
In this mechanism, related records from one or more relations are kept in the same disk block.
◦ The ordering of records is not based on primary key or search key.
◦ Clustered file organization is not considered good for large databases.
There are two types of clustered file organization methods in DBMS
◦ Indexed Clusters: The tables are combined on the basis of the clustered key.
◦ Hash Clusters: The tables are combined on the basis of the hash value of the clustered keys,
and we store the results on the basis of the same hash key value.
File Operations
◦ Creation: It refers to the process of creating a file from the file system of a database management
system.
◦ When a file is deleted, it is permanently removed from the file system, along with all its data.
◦ Open: A file can be opened in one of the two modes, read mode or write mode.
◦ In read mode, the operating system does not allow anyone to alter data. In other words, data is
read only. Files opened in read mode can be shared among several entities.
◦ Write mode allows data modification. Files opened in write mode can be read but cannot be
shared.
◦ Locate: Every file has a file pointer, which tells the current position where the data is to be read
or written. This pointer can be adjusted accordingly. Using find (seek) operation, it can be moved
forward or backward.
◦ Read: By default, when files are opened in read mode, the file pointer points to the beginning of
the file. There are options where the user can tell the operating system where to locate the file
pointer at the time of opening a file. The very next data to the file pointer is read.
File Operations Continue…
Write: User can select to open a file in write mode, which enables them to edit its contents. It
can be deletion, insertion, or modification. The file pointer can be located at the time of
opening or can be dynamically changed if the operating system allows to do so.
Close: This is the most important operation from the operating system’s point of view is when a
request to close a file is generated.
While closing a file the operating system performs the following activities;
◦ removes all the locks (if in shared mode),
◦ saves the data (if altered) to the secondary storage media, and
◦ releases all the buffers and file handlers associated with the file.
The organization of data inside a file plays a major role here. The process to locate the file
pointer to a desired record inside a file varies based on whether the records are arranged
sequentially or clustered.
Categories of File Operations
Operations on database files can be broadly classified into two categories, In both types of
operations, selection plays a significant role.
Update Operations - Update operations change the data values by insertion, deletion, or
update.
Retrieval Operations - Retrieval operations, on the other hand, do not alter the data but
retrieve them after optional conditional filtering.
Review Questions
1. Compare various Storage Types.
2. Illustrate the memory hierarchy with suitable diagram.
3. Explain various Categories of Storage Devices.
4. Define the following terms;
◦ Cache memory, RAM,
◦ USB memory, SSD,
◦ Magnetic disk memory, Magnetic tape memory, Optical disk memory
5. Explain various Magnetic disk memory components
6. Differentiate between Spanned and un-spanned records.
7. What is RAID?
8. Compare RAID 0, RAID 1 and RAID 2 with the help of suitable diagrams.
Review Questions
9. Define File Structure.
10. Explain File Organization.
11. Explain the following types of file organization with suitable diagram;
◦ Heap File Organization, Sequential File Organization, Hash File Organization, Clustered File
Organization
12. What are the different operation that can be performed on a File in DBMS?
13. What are different modes of opening a file?
14. Differentiate between read mode or write mode of opening a file in DBMS.
15. Define various Categories of File Operations.
16. What are the activities performed by operating system while closing a file?
17. Differentiate between Update Operations and Retrieval Operations

More Related Content

Similar to Storage Media and File Organisation.pptx

Mass Storage Structure
Mass Storage StructureMass Storage Structure
Mass Storage Structure
Vimalanathan D
 
Ch14 OS
Ch14 OSCh14 OS
Ch14 OS
C.U
 
OSCh14
OSCh14OSCh14
OS_Ch14
OS_Ch14OS_Ch14
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
raima sen
 
DBMS RAID.pptx
DBMS RAID.pptxDBMS RAID.pptx
DBMS RAID.pptx
PerumalRaja12
 
BAIT1003 Chapter 5
BAIT1003 Chapter 5BAIT1003 Chapter 5
BAIT1003 Chapter 5
limsh
 
Pandi
PandiPandi
Pandi
Pandi C
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
Nightcrowl
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
Nightcrowl
 
Storage System and Backup Media
Storage System and Backup MediaStorage System and Backup Media
Storage System and Backup Media
ImranulHasan6
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
Wayne Jones Jnr
 
Nachos Extra Points
Nachos Extra PointsNachos Extra Points
Nachos Extra Points
Eduardo Triana
 
Introduction to Hard Disk Drive by Vishal Garg
Introduction to Hard Disk Drive by Vishal GargIntroduction to Hard Disk Drive by Vishal Garg
Introduction to Hard Disk Drive by Vishal Garg
IBNC India - India's Biggest Networking Championship
 
Types of secondary storage devices ppt
Types of secondary storage devices pptTypes of secondary storage devices ppt
Types of secondary storage devices ppt
Surkhab Shelly
 
Os
OsOs
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
koolkampus
 
Db
DbDb
db
dbdb
db
Aisu
 
Unit 4 DBMS.ppt
Unit 4 DBMS.pptUnit 4 DBMS.ppt
Unit 4 DBMS.ppt
HARRSHITHAASCSE
 

Similar to Storage Media and File Organisation.pptx (20)

Mass Storage Structure
Mass Storage StructureMass Storage Structure
Mass Storage Structure
 
Ch14 OS
Ch14 OSCh14 OS
Ch14 OS
 
OSCh14
OSCh14OSCh14
OSCh14
 
OS_Ch14
OS_Ch14OS_Ch14
OS_Ch14
 
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
You will get DBA Jobs If You Learn What is Storage System, Hurry Up!
 
DBMS RAID.pptx
DBMS RAID.pptxDBMS RAID.pptx
DBMS RAID.pptx
 
BAIT1003 Chapter 5
BAIT1003 Chapter 5BAIT1003 Chapter 5
BAIT1003 Chapter 5
 
Pandi
PandiPandi
Pandi
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Storage System and Backup Media
Storage System and Backup MediaStorage System and Backup Media
Storage System and Backup Media
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
Nachos Extra Points
Nachos Extra PointsNachos Extra Points
Nachos Extra Points
 
Introduction to Hard Disk Drive by Vishal Garg
Introduction to Hard Disk Drive by Vishal GargIntroduction to Hard Disk Drive by Vishal Garg
Introduction to Hard Disk Drive by Vishal Garg
 
Types of secondary storage devices ppt
Types of secondary storage devices pptTypes of secondary storage devices ppt
Types of secondary storage devices ppt
 
Os
OsOs
Os
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
Db
DbDb
Db
 
db
dbdb
db
 
Unit 4 DBMS.ppt
Unit 4 DBMS.pptUnit 4 DBMS.ppt
Unit 4 DBMS.ppt
 

Recently uploaded

Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 

Recently uploaded (20)

Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 

Storage Media and File Organisation.pptx

  • 1. Database Management Systems (ITEC-212) UNIT 1 - STORAGE SYSTEM AND FILE STRUCTURE
  • 2. Unit Overview ◦ Storage System ◦ Types of Memory ◦ Spanned and un-spanned records ◦ RAID and its types ◦ File Structure ◦ File Organization and its types ◦ File Operations
  • 3. Storage System Databases are stored in file formats, which contain records. At physical level, the actual data is stored in electromagnetic format on some device. These storage devices can be broadly categorized into three types:
  • 4. Categories of Storage Devices Primary Storage: The memory storage that is directly accessible to the CPU comes under this category. CPU's internal memory (registers), fast memory (cache), and main memory (RAM) are directly accessible to the CPU, as they are all placed on the motherboard or CPU chipset. This storage is typically very small, ultra-fast, and volatile. Primary storage requires continuous power supply in order to maintain its state. In case of a power failure, all its data is lost. Secondary Storage: Secondary storage devices are used to store data for future use or as backup. Secondary storage includes memory devices that are not a part of the CPU chipset or motherboard, for example hard disks, SSD, flash drive/USB drive. Tertiary Storage: Tertiary storage is a type of secondary storage that is mainly used to store huge volumes of data. Since such storage devices are external to the computer system, they are the slowest in speed. These storage devices are mostly used to take the back up of an entire system. For example magnetic tapes has been widely used as tertiary storage where as cloud storage and network-attached storage (NAS) are the recent trends in tertiary storage.
  • 5. Memory Hierarchy A computer system has a well-defined hierarchy of memory. A CPU has direct access to it main memory as well as its inbuilt registers. The access time of the main memory is obviously less than the CPU speed. To minimize the speed mismatch of CPU and main memory, cache memory is introduced. Cache memory provides the fastest access time and it contains data that is most frequently accessed by the CPU. The memory with the fastest access is the costliest one. Larger storage devices offer slow speed and they are less expensive, however they can store huge volumes of data as compared to CPU registers or cache memory.
  • 7. Comparison of Storage Types Storage Type Speed Capacity Cost Durability Volatility Cache Very fast (10-100 GB/s) Very small (1-32 MB) Expensive ($10-100/MB) Low Yes RAM Fast (5-40 GB/s) Medium (2-64 GB) Moderate ($5-10/GB) Low Yes USB Fast (10-200 MB/s) Small (4-256 GB) Moderate ($0.5-1/GB) High No SSD Fast (100-500 MB/s) Large (128 GB-4 TB) Expensive ($10-100/MB ) High No Magnetic disk Moderate (50-200 MB/s) Large (500 GB-10 TB) Low ($0.02-0.05/GB) Low No Optical storage Slow (5-50 MB/s) Moderate (700 MB-50 GB) Low ($0.01-0.1/GB) Low No Magnetic tape Slow (100-300 MB/s) Large (500 GB-30 TB) Very low ($0.005-0.02/GB) Moderate No
  • 8. Cache memory ◦ Cache memory is very fast and very small. ◦ It is used to store data that the CPU needs often. ◦ It is close to the CPU and has different levels. ◦ It is expensive and loses data when the power is off.
  • 9. Random Access Memory ◦ RAM is fast and medium-sized. ◦ It is used to store data and programs that are running on the computer. ◦ It is directly accessed by the CPU and has two types: DRAM and SRAM. ◦ It is cheaper than cache memory but more expensive than secondary memory. ◦ It also loses data when the power is off.
  • 10. Universal Serial Bus memory ◦ USB memory is a small and portable device that uses flash memory. ◦ It is used to store and transfer data between different devices. ◦ It has no moving parts and uses less power. ◦ It is faster than secondary memory but slower than RAM memory. ◦ It has limited capacity and write cycles. ◦ It can lose data if it is not properly ejected or unplugged.
  • 11. Solid State Drive ◦ SSD memory is a large and fast device that uses flash memory. ◦ It is used to replace hard disk drives in computers and laptops. ◦ It has no moving parts and uses less power. ◦ It is faster, quieter, and more reliable than hard disk drives. ◦ However, it is more expensive, has limited write cycles, and can lose data when the power is off.
  • 12. Magnetic disk memory ◦ Magnetic disk memory is a large and moderate device that uses magnetized materials. ◦ It is used to store large amounts of data that do not need frequent access. ◦ It has rotating disks and moving parts. ◦ It uses more power and makes noise. ◦ It is prone to mechanical failures, data corruption, and physical damage. ◦ It is cheaper than solid state memory but more expensive than optical memory. ◦ A read/write head moves in between the disks and is used to magnetize or de-magnetize the spot under it. ◦ A magnetized spot can be recognized as 0 (zero) or 1 (one).
  • 13. Magnetic disk memory components •A Platters is a round disc that can store data on both sides. •A Heads is advice that can read and write data on the platters. •An actuator arms is a device that can move the heads across the platters. •A hard disk has rings of data called tracks that are divided into small pieces called sectors. A sector on a hard disk typically stores 512 bytes of data. •The groups of sectors are called clusters that can store files or parts of files. •The sets of tracks on hard disk is called cylinders that are formed by the movement of the heads. •Formatting divides tracks into equal sized disk blocks. These blocks are separated by interblock gaps
  • 14. Spanned and un-spanned records Spanned and un-spanned records are two ways of mapping file records into blocks of disk. A file record is a unit of data that belongs to a file. A block is a unit of storage on the disk. Spanned Record Un-Spanned Record A spanned record is a record that can be divided into segments and stored in two or more consecutive blocks. An un-spanned record is a record that must be stored in one block completely.
  • 15. Optical disk memory ◦ Optical disk memory is a moderate and slow device that uses lasers. ◦ It is used to store data that need to be distributed or archived. ◦ It has reflective surfaces and moving parts. ◦ It is vulnerable to scratches, dust, and heat. ◦ It is less reliable and has shorter lifespan than magnetic and solid state memory. ◦ It is cheaper than magnetic memory but more expensive than magnetic tape memory. ◦ Pit and land are the two basic components of an optical disc's surface. ◦ A pit is a small depression or hole in the disc's reflective layer, while a land is a flat area. ◦ These variations in the disc's surface represent the digital information stored on the disc.
  • 16. Magnetic tape memory ◦ Magnetic tape memory is a large and slow device that uses magnetized materials. ◦ It is used to store data backups and archives. ◦ It has thin plastic ribbons and moving parts. ◦ It is cheaper, has higher capacity, and has longer lifespan than other types of memory. ◦ However, it is slower, has sequential access, and is more prone to wear and tear. ◦ It is less convenient and less compatible than other types of memory.
  • 17. RAID ◦ RAID stands for Redundant Array of Independent Disks, which is a technology to connect multiple secondary storage devices and use them as a single storage media. ◦ RAID consists of an array of disks in which multiple disks are connected together to achieve different goals. ◦ RAID levels define the use of disk arrays.
  • 18. RAID 0 ◦ In this level, a striped array of disks is implemented. ◦ The data is broken down into blocks and the blocks are distributed among disks. ◦ Each disk receives a block of data to write/read in parallel. ◦ It enhances the speed and performance of the storage device. ◦ There is no parity and backup in Level 0.
  • 19. RAID 1 ◦ RAID 1 uses mirroring techniques. ◦ When data is sent to a RAID controller, it sends a copy of data to all the disks in the array. ◦ RAID level 1 is also called mirroring and provides 100% redundancy in case of a failure.
  • 20. RAID 2 ◦ RAID 2 records Error Correction Code using Hamming distance for its data, striped on different disks. ◦ Like level 0, each data bit in a word is recorded on a separate disk and ECC codes of the data words are stored on a different set disks. ◦ Due to its complex structure and high cost, RAID 2 is not commercially available.
  • 21. RAID 3 (Self Study) ◦ RAID 3 stripes the data onto multiple disks. ◦ The parity bit generated for data word is stored on a different disk. ◦ This technique makes it to overcome single disk failures.
  • 22. RAID 4 (Self Study) ◦ In this level, an entire block of data is written onto data disks and then the parity is generated and stored on a different disk. ◦ Note that, level 3 uses byte-level striping, whereas level 4 uses block-level striping. ◦ Both level 3 and level 4 require at least three disks to implement RAID.
  • 23. RAID 5 (Self Study) RAID 5 writes whole data blocks onto different disks, but the parity bits generated for data block stripe are distributed among all the data disks rather than storing them on a different dedicated disk.
  • 24. RAID 6 (Self Study) ◦ RAID 6 is an extension of level 5. ◦ In this level, two independent parities are generated and stored in distributed fashion among multiple disks. ◦ Two parities provide additional fault tolerance. This level requires at least four disk drives to implement RAID.
  • 25. File Structure File Structure: A file structure in DBMS refers to the organization and arrangement of data within a file. It defines how data is stored, accessed, and retrieved from the file. ◦ A file is a sequence of records stored in binary format. ◦ A disk drive is formatted into several blocks that can store records. ◦ File records are mapped onto those disk blocks.
  • 26. File Organization File Organization defines how file records are mapped onto disk blocks. We have four types of File Organization to organize file records:
  • 27. Heap File Organization ◦ When a file is created using Heap File Organization, the Operating System allocates memory area to that file without any further accounting details. ◦ File records can be placed anywhere in that memory area. ◦ It is the responsibility of the software to manage the records. ◦ Heap File does not support any ordering, sequencing, or indexing on its own.
  • 28. Sequential File Organization ◦ Every file record contains a data field (attribute) to uniquely identify that record. ◦ In sequential file organization, records are placed in the file in some sequential order based on the unique key field or search key. ◦ Practically, it is not possible to store all the records sequentially in physical form.
  • 29. Hash File Organization ◦ Hash File Organization uses Hash function computation on some fields of the records. ◦ The output of the hash function determines the location of disk block where the records are to be placed.
  • 30. Clustered File Organization In this mechanism, related records from one or more relations are kept in the same disk block. ◦ The ordering of records is not based on primary key or search key. ◦ Clustered file organization is not considered good for large databases. There are two types of clustered file organization methods in DBMS ◦ Indexed Clusters: The tables are combined on the basis of the clustered key. ◦ Hash Clusters: The tables are combined on the basis of the hash value of the clustered keys, and we store the results on the basis of the same hash key value.
  • 31. File Operations ◦ Creation: It refers to the process of creating a file from the file system of a database management system. ◦ When a file is deleted, it is permanently removed from the file system, along with all its data. ◦ Open: A file can be opened in one of the two modes, read mode or write mode. ◦ In read mode, the operating system does not allow anyone to alter data. In other words, data is read only. Files opened in read mode can be shared among several entities. ◦ Write mode allows data modification. Files opened in write mode can be read but cannot be shared. ◦ Locate: Every file has a file pointer, which tells the current position where the data is to be read or written. This pointer can be adjusted accordingly. Using find (seek) operation, it can be moved forward or backward. ◦ Read: By default, when files are opened in read mode, the file pointer points to the beginning of the file. There are options where the user can tell the operating system where to locate the file pointer at the time of opening a file. The very next data to the file pointer is read.
  • 32. File Operations Continue… Write: User can select to open a file in write mode, which enables them to edit its contents. It can be deletion, insertion, or modification. The file pointer can be located at the time of opening or can be dynamically changed if the operating system allows to do so. Close: This is the most important operation from the operating system’s point of view is when a request to close a file is generated. While closing a file the operating system performs the following activities; ◦ removes all the locks (if in shared mode), ◦ saves the data (if altered) to the secondary storage media, and ◦ releases all the buffers and file handlers associated with the file. The organization of data inside a file plays a major role here. The process to locate the file pointer to a desired record inside a file varies based on whether the records are arranged sequentially or clustered.
  • 33. Categories of File Operations Operations on database files can be broadly classified into two categories, In both types of operations, selection plays a significant role. Update Operations - Update operations change the data values by insertion, deletion, or update. Retrieval Operations - Retrieval operations, on the other hand, do not alter the data but retrieve them after optional conditional filtering.
  • 34. Review Questions 1. Compare various Storage Types. 2. Illustrate the memory hierarchy with suitable diagram. 3. Explain various Categories of Storage Devices. 4. Define the following terms; ◦ Cache memory, RAM, ◦ USB memory, SSD, ◦ Magnetic disk memory, Magnetic tape memory, Optical disk memory 5. Explain various Magnetic disk memory components 6. Differentiate between Spanned and un-spanned records. 7. What is RAID? 8. Compare RAID 0, RAID 1 and RAID 2 with the help of suitable diagrams.
  • 35. Review Questions 9. Define File Structure. 10. Explain File Organization. 11. Explain the following types of file organization with suitable diagram; ◦ Heap File Organization, Sequential File Organization, Hash File Organization, Clustered File Organization 12. What are the different operation that can be performed on a File in DBMS? 13. What are different modes of opening a file? 14. Differentiate between read mode or write mode of opening a file in DBMS. 15. Define various Categories of File Operations. 16. What are the activities performed by operating system while closing a file? 17. Differentiate between Update Operations and Retrieval Operations