SlideShare una empresa de Scribd logo
1 de 26
VIJAY KUMAR SHARMA 1
Storing Data
Disk Organization and I/O
www.kumarvijaybaswa.blogspot.com
VIJAY KUMAR SHARMA 2
Disks
 DBMS stores information on (“hard”) disks.
 This has major implications for DBMS
design!
• READ: transfer data from disk to main memory
(RAM).
• WRITE: transfer data from RAM to disk.
• Both are high-cost operations, relative to in-
memory operations, so must be planned
carefully!
VIJAY KUMAR SHARMA 3
Why Not Store Everything in Main Memory?
 Costs too much. $1000 will buy you
over 128MB of RAM or 7.5GB of disk
today.
 Main memory is volatile. We want data
to be saved between runs.
(Obviously!)
VIJAY KUMAR SHARMA 4
 Typical storage hierarchy:
• Main memory (RAM) for currently used
data.
• Disk for the main database (secondary
storage).
• Tapes for archiving older versions of the
data (tertiary storage).
VIJAY KUMAR SHARMA 5
Disks
 Secondary storage device of
choice.
 Main advantage over tapes:
random access vs. sequential.
 Data is stored and retrieved in
units called disk blocks or pages.
VIJAY KUMAR SHARMA 6
 Unlike RAM, time to retrieve a disk
page varies depending upon location
on disk.
• Therefore, relative placement of pages
on disk has major impact on DBMS
performance!
VIJAY KUMAR SHARMA 7
Components of a Disk
Platters
The platters spin (say, 100rps).
Spindle
The arm assembly is moved
in or out to position a head
on a desired track. Tracks
under heads make a
cylinder (imaginary!).
Disk head
Arm movement
Arm assembly
Only one head
reads/writes at any
one time.
Tracks
Sector
 Block size is a multiple
of sector size (which is fixed).
VIJAY KUMAR SHARMA 8
Accessing a Disk Page
 Time to access (read/write) a disk
block:
• seek time (moving arms to position disk
head on track)
• rotational delay (waiting for block to
rotate under head)
 often called “rotational latency”
• transfer time (actually moving data
to/from disk surface)
VIJAY KUMAR SHARMA 9
 Seek time and rotational delay dominate.
• Seek time varies from about 1 to 20msec
• Rotational delay varies from 0 to 10msec
• Transfer rate is about 1msec per 4KB page
 Key to lower I/O cost: reduce
seek/rotation delays! Hardware vs.
software solutions?
VIJAY KUMAR SHARMA 10
Arranging Pages on Disk
 `Next’ block concept:
• blocks on same track, followed by
• blocks on same cylinder, followed by
• blocks on adjacent cylinder
 Blocks in a file should be arranged
sequentially on disk (by `next’), to
minimize seek and rotational
delay.
VIJAY KUMAR SHARMA 11
 For a sequential scan, pre-fetching
several pages at a time is a big win!
VIJAY KUMAR SHARMA 12
Disk Space Management
 Lowest layer of DBMS software
manages space on disk.
 Higher levels call upon this layer to:
• allocate/de-allocate a page
• read/write a page
VIJAY KUMAR SHARMA 13
 One such “higher level” is the buffer
manager, which receives a request
to bring a page into memory and
then, if needed, requests the disk
space layer to read the page into the
buffer pool.
VIJAY KUMAR SHARMA 14
Buffer Management in a DBMS
DB
MAIN MEMORY
DISK
disk page
free frame
Page Requests from Higher Levels
BUFFER POOL
choice of frame dictated
by replacement policy
VIJAY KUMAR SHARMA 15
 Data must be in RAM for DBMS to
operate on it!
 Table of <frame#, pageid> pairs is
maintained.
VIJAY KUMAR SHARMA 16
When a Page is Requested ...
 If requested page is not in pool:
• Choose an unpinned frame for
replacement; pin_count := 1
• If frame is dirty, write it to disk
• Read requested page into chosen frame
 Else:
• increment pin_count
VIJAY KUMAR SHARMA 17
 Return its address.
 If requests can be predicted (e.g., sequential scans)
pages can be pre-fetched several pages at a time!
VIJAY KUMAR SHARMA 18
More on Buffer Management
 Requestor of page must unpin it, and
indicate whether page has been
modified:
• dirty bit is used for this.
 Page in pool may be requested many
times:
• a pin count is used. A page is a
candidate for replacement iff pin count
= 0.
VIJAY KUMAR SHARMA 19
 CC & recovery may entail additional
I/O when a frame is chosen for
replacement. (Write-Ahead Log
protocol; more later.)
VIJAY KUMAR SHARMA 20
Buffer Replacement Policy
 Frame is chosen for replacement by
a replacement policy:
• Least-recently-used (LRU), Clock, MRU,
etc.
 Policy can have big impact on # of
I/O’s; depends on the access
pattern.
VIJAY KUMAR SHARMA 21
 Sequential flooding: Nasty situation
caused by LRU + repeated sequential
scans.
• # buffer frames < # pages in file means
each page request causes an I/O. MRU
much better in this situation (but not in
all situations, of course).
VIJAY KUMAR SHARMA 22
Files of Records
 Page or block is OK when doing I/O,
but higher levels of DBMS operate on
records, and files of records.
VIJAY KUMAR SHARMA 23
 FILE: A collection of pages, each
containing a collection of records.
Must support:
• insert/delete/modify record
• read a particular record (specified using
record id)
• scan all records (possibly with some
conditions on the records to be
retrieved)
VIJAY KUMAR SHARMA 24
Disk and File Summary
 Disks provide cheap, non-volatile
storage.
• Random access, but cost depends on
location of page on disk; important to
arrange data sequentially to minimize
seek and rotation delays.
VIJAY KUMAR SHARMA 25
 Buffer manager brings pages into RAM.
• Page stays in RAM until released by
requestor(s).
• Written to disk when frame chosen for
replacement (which is after all requestors
release the page), or earlier.
• Choice of frame to replace based on
replacement policy.
 File layer keeps track of pages in a file,
and supports abstraction of a collection of
records.
VIJAY KUMAR SHARMA 26
End

Más contenido relacionado

La actualidad más candente

Random Access memory.
Random Access memory.Random Access memory.
Random Access memory.RafiulIslam58
 
Db2 and storage management (mullins)
Db2 and storage management (mullins)Db2 and storage management (mullins)
Db2 and storage management (mullins)Craig Mullins
 
Managed disk-Azure Storage Evolution
Managed disk-Azure Storage EvolutionManaged disk-Azure Storage Evolution
Managed disk-Azure Storage EvolutionSiraj Mohammad
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performancexKinAnx
 
Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)Tarah DiNardo
 
DB2 and Storage Management
DB2 and Storage ManagementDB2 and Storage Management
DB2 and Storage ManagementCraig Mullins
 
40 demand paging
40 demand paging40 demand paging
40 demand pagingmyrajendra
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_ScalabilityIsrael Gold
 
Storage Fundamentals Presentation
Storage Fundamentals PresentationStorage Fundamentals Presentation
Storage Fundamentals PresentationJuanDosSantos3
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_ScalabilityIsrael Gold
 
Solid state drive (ssd)
Solid state drive (ssd)Solid state drive (ssd)
Solid state drive (ssd)Mukesh Mirrey
 
Nano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage InfrastructuresNano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage InfrastructuresOpenIO Object Storage
 
Storage devices lesson 1
Storage devices lesson 1Storage devices lesson 1
Storage devices lesson 1Professor Thor
 
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...In-Memory Computing Summit
 
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...In-Memory Computing Summit
 

La actualidad más candente (20)

Random Access memory.
Random Access memory.Random Access memory.
Random Access memory.
 
Db2 and storage management (mullins)
Db2 and storage management (mullins)Db2 and storage management (mullins)
Db2 and storage management (mullins)
 
Managed disk-Azure Storage Evolution
Managed disk-Azure Storage EvolutionManaged disk-Azure Storage Evolution
Managed disk-Azure Storage Evolution
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)
 
Storage memory
Storage memoryStorage memory
Storage memory
 
Disk
DiskDisk
Disk
 
DB2 and Storage Management
DB2 and Storage ManagementDB2 and Storage Management
DB2 and Storage Management
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
 
Dba tuning
Dba tuningDba tuning
Dba tuning
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
 
Disk memory systems
Disk memory systemsDisk memory systems
Disk memory systems
 
Storage Fundamentals Presentation
Storage Fundamentals PresentationStorage Fundamentals Presentation
Storage Fundamentals Presentation
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
 
Solid state drive (ssd)
Solid state drive (ssd)Solid state drive (ssd)
Solid state drive (ssd)
 
Nano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage InfrastructuresNano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage Infrastructures
 
Storage devices lesson 1
Storage devices lesson 1Storage devices lesson 1
Storage devices lesson 1
 
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
 
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
 

Destacado

Presentation of the big external memory
Presentation of the big external memoryPresentation of the big external memory
Presentation of the big external memoryLuis Fernando
 
Operation System
Operation SystemOperation System
Operation SystemANANTHI1997
 
Primary and secondary storage devices
Primary and secondary storage devicesPrimary and secondary storage devices
Primary and secondary storage devicesPichano Kikon
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMSkoolkampus
 
External memory
External memoryExternal memory
External memoryriddhishg
 

Destacado (10)

Hard disk
Hard diskHard disk
Hard disk
 
Hard disk PPT
Hard disk PPTHard disk PPT
Hard disk PPT
 
Presentation of the big external memory
Presentation of the big external memoryPresentation of the big external memory
Presentation of the big external memory
 
Magnetic disk
Magnetic diskMagnetic disk
Magnetic disk
 
Operation System
Operation SystemOperation System
Operation System
 
06 External Memory
06  External  Memory06  External  Memory
06 External Memory
 
Primary and secondary storage devices
Primary and secondary storage devicesPrimary and secondary storage devices
Primary and secondary storage devices
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
External memory
External memoryExternal memory
External memory
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar a Storing data : Disk Organization and I/O

Lecture storage-buffer
Lecture storage-bufferLecture storage-buffer
Lecture storage-bufferKlaas Krona
 
Conceptual framework storage devices (2)
Conceptual framework   storage devices (2)Conceptual framework   storage devices (2)
Conceptual framework storage devices (2)Rajendra Sharma
 
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce ServerInitial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce ServerBilly Newport
 
Disks and Stable Storage.ppt
Disks and Stable Storage.pptDisks and Stable Storage.ppt
Disks and Stable Storage.pptjguuhxxxfp
 
What is the future of disk drives?
What is the future of disk drives?What is the future of disk drives?
What is the future of disk drives?Iftikhar Alam
 
04.01 file organization
04.01 file organization04.01 file organization
04.01 file organizationBishal Ghimire
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptNikhilKumarJaiswal2
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage mediaSrinath Sri
 
Presentation database on flash
Presentation   database on flashPresentation   database on flash
Presentation database on flashxKinAnx
 
Dbms by jeet goyal
Dbms by jeet goyalDbms by jeet goyal
Dbms by jeet goyaljeet1991
 
DownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdfDownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdfHanaBurhan1
 
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedEqunix Business Solutions
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45myrajendra
 
The life and times
The life and timesThe life and times
The life and timesAbeer Naskar
 
Managing Memory & Locks - Series 1 Memory Management
Managing  Memory & Locks - Series 1 Memory ManagementManaging  Memory & Locks - Series 1 Memory Management
Managing Memory & Locks - Series 1 Memory ManagementDAGEOP LTD
 

Similar a Storing data : Disk Organization and I/O (20)

Lecture storage-buffer
Lecture storage-bufferLecture storage-buffer
Lecture storage-buffer
 
Conceptual framework storage devices (2)
Conceptual framework   storage devices (2)Conceptual framework   storage devices (2)
Conceptual framework storage devices (2)
 
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce ServerInitial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
 
Disks and Stable Storage.ppt
Disks and Stable Storage.pptDisks and Stable Storage.ppt
Disks and Stable Storage.ppt
 
What is the future of disk drives?
What is the future of disk drives?What is the future of disk drives?
What is the future of disk drives?
 
04.01 file organization
04.01 file organization04.01 file organization
04.01 file organization
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Kinetic basho public
Kinetic basho publicKinetic basho public
Kinetic basho public
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage media
 
Presentation database on flash
Presentation   database on flashPresentation   database on flash
Presentation database on flash
 
Dbms by jeet goyal
Dbms by jeet goyalDbms by jeet goyal
Dbms by jeet goyal
 
DownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdfDownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdf
 
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45
 
The life and times
The life and timesThe life and times
The life and times
 
Cmp
CmpCmp
Cmp
 
Managing Memory & Locks - Series 1 Memory Management
Managing  Memory & Locks - Series 1 Memory ManagementManaging  Memory & Locks - Series 1 Memory Management
Managing Memory & Locks - Series 1 Memory Management
 
운영체제론 Ch13
운영체제론 Ch13운영체제론 Ch13
운영체제론 Ch13
 

Más de Computer Hardware & Trouble shooting (7)

Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
Vlsm
VlsmVlsm
Vlsm
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Php tutorial
Php  tutorialPhp  tutorial
Php tutorial
 
Mcse question
Mcse questionMcse question
Mcse question
 
Css notes
Css notesCss notes
Css notes
 
File organization
File organizationFile organization
File organization
 

Último

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Último (20)

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Storing data : Disk Organization and I/O

  • 1. VIJAY KUMAR SHARMA 1 Storing Data Disk Organization and I/O www.kumarvijaybaswa.blogspot.com
  • 2. VIJAY KUMAR SHARMA 2 Disks  DBMS stores information on (“hard”) disks.  This has major implications for DBMS design! • READ: transfer data from disk to main memory (RAM). • WRITE: transfer data from RAM to disk. • Both are high-cost operations, relative to in- memory operations, so must be planned carefully!
  • 3. VIJAY KUMAR SHARMA 3 Why Not Store Everything in Main Memory?  Costs too much. $1000 will buy you over 128MB of RAM or 7.5GB of disk today.  Main memory is volatile. We want data to be saved between runs. (Obviously!)
  • 4. VIJAY KUMAR SHARMA 4  Typical storage hierarchy: • Main memory (RAM) for currently used data. • Disk for the main database (secondary storage). • Tapes for archiving older versions of the data (tertiary storage).
  • 5. VIJAY KUMAR SHARMA 5 Disks  Secondary storage device of choice.  Main advantage over tapes: random access vs. sequential.  Data is stored and retrieved in units called disk blocks or pages.
  • 6. VIJAY KUMAR SHARMA 6  Unlike RAM, time to retrieve a disk page varies depending upon location on disk. • Therefore, relative placement of pages on disk has major impact on DBMS performance!
  • 7. VIJAY KUMAR SHARMA 7 Components of a Disk Platters The platters spin (say, 100rps). Spindle The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder (imaginary!). Disk head Arm movement Arm assembly Only one head reads/writes at any one time. Tracks Sector  Block size is a multiple of sector size (which is fixed).
  • 8. VIJAY KUMAR SHARMA 8 Accessing a Disk Page  Time to access (read/write) a disk block: • seek time (moving arms to position disk head on track) • rotational delay (waiting for block to rotate under head)  often called “rotational latency” • transfer time (actually moving data to/from disk surface)
  • 9. VIJAY KUMAR SHARMA 9  Seek time and rotational delay dominate. • Seek time varies from about 1 to 20msec • Rotational delay varies from 0 to 10msec • Transfer rate is about 1msec per 4KB page  Key to lower I/O cost: reduce seek/rotation delays! Hardware vs. software solutions?
  • 10. VIJAY KUMAR SHARMA 10 Arranging Pages on Disk  `Next’ block concept: • blocks on same track, followed by • blocks on same cylinder, followed by • blocks on adjacent cylinder  Blocks in a file should be arranged sequentially on disk (by `next’), to minimize seek and rotational delay.
  • 11. VIJAY KUMAR SHARMA 11  For a sequential scan, pre-fetching several pages at a time is a big win!
  • 12. VIJAY KUMAR SHARMA 12 Disk Space Management  Lowest layer of DBMS software manages space on disk.  Higher levels call upon this layer to: • allocate/de-allocate a page • read/write a page
  • 13. VIJAY KUMAR SHARMA 13  One such “higher level” is the buffer manager, which receives a request to bring a page into memory and then, if needed, requests the disk space layer to read the page into the buffer pool.
  • 14. VIJAY KUMAR SHARMA 14 Buffer Management in a DBMS DB MAIN MEMORY DISK disk page free frame Page Requests from Higher Levels BUFFER POOL choice of frame dictated by replacement policy
  • 15. VIJAY KUMAR SHARMA 15  Data must be in RAM for DBMS to operate on it!  Table of <frame#, pageid> pairs is maintained.
  • 16. VIJAY KUMAR SHARMA 16 When a Page is Requested ...  If requested page is not in pool: • Choose an unpinned frame for replacement; pin_count := 1 • If frame is dirty, write it to disk • Read requested page into chosen frame  Else: • increment pin_count
  • 17. VIJAY KUMAR SHARMA 17  Return its address.  If requests can be predicted (e.g., sequential scans) pages can be pre-fetched several pages at a time!
  • 18. VIJAY KUMAR SHARMA 18 More on Buffer Management  Requestor of page must unpin it, and indicate whether page has been modified: • dirty bit is used for this.  Page in pool may be requested many times: • a pin count is used. A page is a candidate for replacement iff pin count = 0.
  • 19. VIJAY KUMAR SHARMA 19  CC & recovery may entail additional I/O when a frame is chosen for replacement. (Write-Ahead Log protocol; more later.)
  • 20. VIJAY KUMAR SHARMA 20 Buffer Replacement Policy  Frame is chosen for replacement by a replacement policy: • Least-recently-used (LRU), Clock, MRU, etc.  Policy can have big impact on # of I/O’s; depends on the access pattern.
  • 21. VIJAY KUMAR SHARMA 21  Sequential flooding: Nasty situation caused by LRU + repeated sequential scans. • # buffer frames < # pages in file means each page request causes an I/O. MRU much better in this situation (but not in all situations, of course).
  • 22. VIJAY KUMAR SHARMA 22 Files of Records  Page or block is OK when doing I/O, but higher levels of DBMS operate on records, and files of records.
  • 23. VIJAY KUMAR SHARMA 23  FILE: A collection of pages, each containing a collection of records. Must support: • insert/delete/modify record • read a particular record (specified using record id) • scan all records (possibly with some conditions on the records to be retrieved)
  • 24. VIJAY KUMAR SHARMA 24 Disk and File Summary  Disks provide cheap, non-volatile storage. • Random access, but cost depends on location of page on disk; important to arrange data sequentially to minimize seek and rotation delays.
  • 25. VIJAY KUMAR SHARMA 25  Buffer manager brings pages into RAM. • Page stays in RAM until released by requestor(s). • Written to disk when frame chosen for replacement (which is after all requestors release the page), or earlier. • Choice of frame to replace based on replacement policy.  File layer keeps track of pages in a file, and supports abstraction of a collection of records.