SlideShare a Scribd company logo
Recap of Feb 25: Physical Storage Media
• Issues are speed, cost, reliability
• Media types:
– Primary storage (volatile): Cache, Main Memory
– Secondary or On-line storage (non-volatile): Flash Memory, Mag Disk
– Tertiary or Off-line storage (non-volatile): Optical Storage, Tape Storage
• Mag disk issues
– definitions: sector, track, cylinder
– disk controllers, multiple disks
– disk performance measures (seek time, rotational latency, data transfer
rate, MTTF)
• Now we start with Optimization of Disk-Block Access
Optimization of Disk-Block Access:
Motivation
• Requests for disk I/O are generated both by the file system and by the
virtual memory manager
• Each request specifies the address on the disk to be referenced in the
form of a block number
– a block is a contiguous sequence of sectors from a single track on one
platter
– block sizes range from 512 bytes to several K (4 -- 16K is typical)
– smaller blocks mean more transfers from disk; larger blocks makes for
more wasted space due to partially filled blocks
– block is the standard unit of data transfer between disk to main memory
• Since disk access speed is much slower than main memory access,
methods for optimizing disk-block access are important
Optimization of Disk-Block Access:
Methods
• Disk-arm Scheduling: requests for several blocks may be
speeded up by requesting them in the order they will pass
under the head.
– If the blocks are on different cylinders, it is advantageous to ask
for them in an order that minimizes disk-arm movement
– Elevator algorithm -- move the disk arm in one direction until all
requests from that direction are satisfied, then reverse and repeat
– Sequential access is 1-2 orders of magnitude faster; random access
is about 2 orders of magnitude slower
Optimization of Disk-Block Access:
Methods
• Non-volatile write buffers
– store written data in a RAM buffer rather than on disk
– write the buffer whenever it becomes full or when no other disk
requests are pending
– buffer must be non-volatile to protect from power failure
• called non-volatile random-access memory (NV-RAM)
• typically implemented with battery-backed-up RAM
– dramatic speedup on writes; with a reasonable-sized buffer write
latency essentially disappears
– why can’t we do the same for reads? (hints: ESP, clustering)
Optimization of Disk-Block Access:
Methods
• File organization (Clustering): reduce access time by
organizing blocks on disk in a way that corresponds
closely to the way we expect them to be accessed
– sequential files should be kept organized sequentially
– hierarchical files should be organized with mothers next to
daughters
– for joining tables (relations) put the joining tuples next to each
other
– over time fragmentation can become an issue
• restoration of disk structure (copy and rewrite, reordered) controls
fragmentation
Optimization of Disk-Block Access:
Methods
• Log-based file system
– does not update in-place, rather writes updates to a log disk
• essentially, a disk functioning as a non-volatile RAM write buffer
– all access in the log disk is sequential, eliminating seek time
– eventually updates must be propogated to the original blocks
• as with NV-RAM write buffers, this can occur at a time when no disk
requests are pending
• the updates can be ordered to minimize arm movement
– this can generate a high degree of fragmentation on files that
require constant updates
• fragmentation increases seek time for sequential reading of files
Storage Access (11.5)
• Basic concepts (some already familiar):
– block-based. A block is a contiguous sequence of sectors from a single
track; blocks are units of both storage allocation and data transfer
– a file is a sequence of records stored in fixed-size blocks (pages) on the
disk
– each block (page) has a unique address called BID
– optimization is done by reducing I/O, seek time, etc.
– database systems seek to minimize the number of block transfers between
the disk and memory. We can reduce the number of disk accesses by
keeping as many blocks as possible in main memory.
– Buffer - portion of main memory used to store copies of disk blocks
– buffer manager - subsystem responsible for allocating buffer space in
main memory and handling block transfer between buffer and disk
Buffer Management
• The buffer pool is the part of the main memory alocated for
temporarily storing disk blocks read from disk and made available to
the CPU
• The buffer manager is the subsystem responsible for the allocation and
the management of the buffer space (transparent to users)
• On a process (user) request for a block (page) the buffer manager:
– checks to see if the page is already in the buffer pool
– if so, passes the address to the process
– if not, it loads the page from disk and then passes the address to the process
– loading a page might require clearing (writing out) a page to make space
• Very similar to the way virtual memory managers work, although it can do a
lot better (why?)
Buffer Replacement Strategies
• Most operating systems use a LRU replacement scheme. In database
environments, MRU is better for some common operations (e.g., join)
– LRU strategy: replace the least recently used block
– MRU strategy: replace the most recently used block
• Sometimes it is useful to fasten or pin blocks to keep them available
during an operation and not let the replacement strategy touch them
– pinned block is thus a block that is not allowed to be written back to disk
• There are situations where it is necessary to write back a block to disk
even though the buffer space it occupies is not yet needed. This write
is called the forced output of a block; useful in recovery situations
• Toss-immediate strategy: free the space occupied by a block as soon as
the final tuple of that block has been processed
Buffer Replacement Strategies
• Most recently used (MRU) strategy: system must pin the block
currently being processed. After the final tuple of that block has been
processed the block is unpinned and becomes the most recently used
block. This is essentially “toss-immediate” with pinning, and works
very well with joins.
• The buffer manager can often use other information (design or
statistical) to predict the probability that a request will reference a
particular page
– e.g., the data dictionary is frequently accessed -- keep the data dictionary
blocks in main memory buffer
– if several pages are available for overwrite; choose the one that has the
lowest number of recent access requests to replace
Buffer Management (cont)
• Existing OS affect DBMS operations by:
– read ahead, write behind
– wrong replacement strategies
– Unix is not good for DBMS to run on top
– Most commercial systems implement their own I/O on a raw disk
partition
• Variations of buffer allocation
– common buffer pool for all relations
– separate buffer pool for each relation
– as above but with relations borrowing space from each other
– prioritized buffers for very frequently accessed blocks, e.g. data
dictionary
Buffer Management (cont)
• For each buffer the manager keeps the following:
– which disk and which block it is in
– whether the block is dirty (has been modified) or not (why?)
– information for the replacement strategy
• last time block was accessed
• whether it is pinned
• possible statistical information (access frequency etc.)
Buffer Management and Disk-block
Access Optimization (end)
• Disk-block access methods must take care of some
information within each block, as well as information
about each block:
– allocate records (tuples) within blocks
– support record addressing by address and by value
– support auxiliary (secondary indexing) file structures for more
efficient processing
• These concerns are linked in to our next topic:
file organization.

More Related Content

What's hot (20)

overview of physical storage media
overview of physical storage mediaoverview of physical storage media
overview of physical storage media
Aisu
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Swapping | Computer Science
Swapping | Computer ScienceSwapping | Computer Science
Swapping | Computer Science
Transweb Global Inc
 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
Srirengasrirenga
 
Memory managment
Memory managmentMemory managment
Memory managment
Shahbaz Khan
 
Memory management
Memory managementMemory management
Memory management
Vishal Singh
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Memory management
Memory managementMemory management
Memory management
Mohammad Sadiq
 
Operating system 4 files by adi
Operating system 4 files by adiOperating system 4 files by adi
Operating system 4 files by adi
Prof. Dr. K. Adisesha
 
Memory management OS
Memory management OSMemory management OS
Memory management OS
UmeshchandraYadav5
 
Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
Transweb Global Inc
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
Anwal Mirza
 
Memory management
Memory managementMemory management
Memory management
soumyaharitha
 
Memory Management
Memory ManagementMemory Management
Memory Management
DEDE IRYAWAN
 
Memory
MemoryMemory
Memory
Mohd Arif
 
Memory Hierarchy Design, Basics, Cache Optimization, Address Translation
Memory Hierarchy Design, Basics, Cache Optimization, Address TranslationMemory Hierarchy Design, Basics, Cache Optimization, Address Translation
Memory Hierarchy Design, Basics, Cache Optimization, Address Translation
Farwa Ansari
 
Memory management
Memory managementMemory management
Memory management
Touhidul Shawan
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
Mukesh Chinta
 
Secondary storage structure-Operating System Concepts
Secondary storage structure-Operating System ConceptsSecondary storage structure-Operating System Concepts
Secondary storage structure-Operating System Concepts
Arjun Kaimattathil
 
Memory management
Memory managementMemory management
Memory management
Mohamed Safraz
 
overview of physical storage media
overview of physical storage mediaoverview of physical storage media
overview of physical storage media
Aisu
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
Transweb Global Inc
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
Anwal Mirza
 
Memory Hierarchy Design, Basics, Cache Optimization, Address Translation
Memory Hierarchy Design, Basics, Cache Optimization, Address TranslationMemory Hierarchy Design, Basics, Cache Optimization, Address Translation
Memory Hierarchy Design, Basics, Cache Optimization, Address Translation
Farwa Ansari
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
Mukesh Chinta
 
Secondary storage structure-Operating System Concepts
Secondary storage structure-Operating System ConceptsSecondary storage structure-Operating System Concepts
Secondary storage structure-Operating System Concepts
Arjun Kaimattathil
 

Viewers also liked (7)

Mba 512 final preso hatim & xiaoyu
Mba 512 final preso hatim & xiaoyuMba 512 final preso hatim & xiaoyu
Mba 512 final preso hatim & xiaoyu
guest200dee1
 
SMAN Cone Crusher
SMAN Cone CrusherSMAN Cone Crusher
SMAN Cone Crusher
Shakti Mining Equipments Pvt. Ltd.
 
Shakti presentation 25.08.11
Shakti presentation 25.08.11Shakti presentation 25.08.11
Shakti presentation 25.08.11
Shakti Mining Equipments Pvt. Ltd.
 
Indonesia
IndonesiaIndonesia
Indonesia
guestc7b101
 
Final evaluation
Final evaluationFinal evaluation
Final evaluation
guestd8373c
 
Mba 512 final preso hatim & xiaoyu
Mba 512 final preso hatim & xiaoyuMba 512 final preso hatim & xiaoyu
Mba 512 final preso hatim & xiaoyu
guest200dee1
 
Powerpoint
PowerpointPowerpoint
Powerpoint
lorena
 
Ad

Similar to Class notesfeb27 (20)

Index file
Index fileIndex file
Index file
SushantGote
 
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
 
storage & file strucure in dbms
storage & file strucure in dbmsstorage & file strucure in dbms
storage & file strucure in dbms
sachin2690
 
Unit 4 DBMS.ppt
Unit 4 DBMS.pptUnit 4 DBMS.ppt
Unit 4 DBMS.ppt
HARRSHITHAASCSE
 
CS 542 Putting it all together -- Storage Management
CS 542 Putting it all together -- Storage ManagementCS 542 Putting it all together -- Storage Management
CS 542 Putting it all together -- Storage Management
J Singh
 
15 bufferand records
15 bufferand records15 bufferand records
15 bufferand records
ashish61_scs
 
Lecture storage-buffer
Lecture storage-bufferLecture storage-buffer
Lecture storage-buffer
Klaas Krona
 
Db
DbDb
Db
VJ Aiswaryadevi
 
db
dbdb
db
Aisu
 
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
 
FILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMSFILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMS
Abhishek Dutta
 
Storage structure1
Storage structure1Storage structure1
Storage structure1
amibuban
 
OS_Ch14
OS_Ch14OS_Ch14
OS_Ch14
Supriya Shrivastava
 
Ch14 OS
Ch14 OSCh14 OS
Ch14 OS
C.U
 
OSCh14
OSCh14OSCh14
OSCh14
Joe Christensen
 
virtual_memory (3).pptx
virtual_memory (3).pptxvirtual_memory (3).pptx
virtual_memory (3).pptx
HyperGamingPUBG
 
Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...
915086731
 
Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...
915086731
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
vampugani
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
Er. Nawaraj Bhandari
 
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
 
storage & file strucure in dbms
storage & file strucure in dbmsstorage & file strucure in dbms
storage & file strucure in dbms
sachin2690
 
CS 542 Putting it all together -- Storage Management
CS 542 Putting it all together -- Storage ManagementCS 542 Putting it all together -- Storage Management
CS 542 Putting it all together -- Storage Management
J Singh
 
15 bufferand records
15 bufferand records15 bufferand records
15 bufferand records
ashish61_scs
 
Lecture storage-buffer
Lecture storage-bufferLecture storage-buffer
Lecture storage-buffer
Klaas Krona
 
db
dbdb
db
Aisu
 
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
 
FILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMSFILE STRUCTURE IN DBMS
FILE STRUCTURE IN DBMS
Abhishek Dutta
 
Storage structure1
Storage structure1Storage structure1
Storage structure1
amibuban
 
Ch14 OS
Ch14 OSCh14 OS
Ch14 OS
C.U
 
Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...
915086731
 
Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...Dulo: an effective buffer cache management scheme to exploit both temporal an...
Dulo: an effective buffer cache management scheme to exploit both temporal an...
915086731
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
vampugani
 
Ad

Recently uploaded (20)

LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
National Information Standards Organization (NISO)
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 

Class notesfeb27

  • 1. Recap of Feb 25: Physical Storage Media • Issues are speed, cost, reliability • Media types: – Primary storage (volatile): Cache, Main Memory – Secondary or On-line storage (non-volatile): Flash Memory, Mag Disk – Tertiary or Off-line storage (non-volatile): Optical Storage, Tape Storage • Mag disk issues – definitions: sector, track, cylinder – disk controllers, multiple disks – disk performance measures (seek time, rotational latency, data transfer rate, MTTF) • Now we start with Optimization of Disk-Block Access
  • 2. Optimization of Disk-Block Access: Motivation • Requests for disk I/O are generated both by the file system and by the virtual memory manager • Each request specifies the address on the disk to be referenced in the form of a block number – a block is a contiguous sequence of sectors from a single track on one platter – block sizes range from 512 bytes to several K (4 -- 16K is typical) – smaller blocks mean more transfers from disk; larger blocks makes for more wasted space due to partially filled blocks – block is the standard unit of data transfer between disk to main memory • Since disk access speed is much slower than main memory access, methods for optimizing disk-block access are important
  • 3. Optimization of Disk-Block Access: Methods • Disk-arm Scheduling: requests for several blocks may be speeded up by requesting them in the order they will pass under the head. – If the blocks are on different cylinders, it is advantageous to ask for them in an order that minimizes disk-arm movement – Elevator algorithm -- move the disk arm in one direction until all requests from that direction are satisfied, then reverse and repeat – Sequential access is 1-2 orders of magnitude faster; random access is about 2 orders of magnitude slower
  • 4. Optimization of Disk-Block Access: Methods • Non-volatile write buffers – store written data in a RAM buffer rather than on disk – write the buffer whenever it becomes full or when no other disk requests are pending – buffer must be non-volatile to protect from power failure • called non-volatile random-access memory (NV-RAM) • typically implemented with battery-backed-up RAM – dramatic speedup on writes; with a reasonable-sized buffer write latency essentially disappears – why can’t we do the same for reads? (hints: ESP, clustering)
  • 5. Optimization of Disk-Block Access: Methods • File organization (Clustering): reduce access time by organizing blocks on disk in a way that corresponds closely to the way we expect them to be accessed – sequential files should be kept organized sequentially – hierarchical files should be organized with mothers next to daughters – for joining tables (relations) put the joining tuples next to each other – over time fragmentation can become an issue • restoration of disk structure (copy and rewrite, reordered) controls fragmentation
  • 6. Optimization of Disk-Block Access: Methods • Log-based file system – does not update in-place, rather writes updates to a log disk • essentially, a disk functioning as a non-volatile RAM write buffer – all access in the log disk is sequential, eliminating seek time – eventually updates must be propogated to the original blocks • as with NV-RAM write buffers, this can occur at a time when no disk requests are pending • the updates can be ordered to minimize arm movement – this can generate a high degree of fragmentation on files that require constant updates • fragmentation increases seek time for sequential reading of files
  • 7. Storage Access (11.5) • Basic concepts (some already familiar): – block-based. A block is a contiguous sequence of sectors from a single track; blocks are units of both storage allocation and data transfer – a file is a sequence of records stored in fixed-size blocks (pages) on the disk – each block (page) has a unique address called BID – optimization is done by reducing I/O, seek time, etc. – database systems seek to minimize the number of block transfers between the disk and memory. We can reduce the number of disk accesses by keeping as many blocks as possible in main memory. – Buffer - portion of main memory used to store copies of disk blocks – buffer manager - subsystem responsible for allocating buffer space in main memory and handling block transfer between buffer and disk
  • 8. Buffer Management • The buffer pool is the part of the main memory alocated for temporarily storing disk blocks read from disk and made available to the CPU • The buffer manager is the subsystem responsible for the allocation and the management of the buffer space (transparent to users) • On a process (user) request for a block (page) the buffer manager: – checks to see if the page is already in the buffer pool – if so, passes the address to the process – if not, it loads the page from disk and then passes the address to the process – loading a page might require clearing (writing out) a page to make space • Very similar to the way virtual memory managers work, although it can do a lot better (why?)
  • 9. Buffer Replacement Strategies • Most operating systems use a LRU replacement scheme. In database environments, MRU is better for some common operations (e.g., join) – LRU strategy: replace the least recently used block – MRU strategy: replace the most recently used block • Sometimes it is useful to fasten or pin blocks to keep them available during an operation and not let the replacement strategy touch them – pinned block is thus a block that is not allowed to be written back to disk • There are situations where it is necessary to write back a block to disk even though the buffer space it occupies is not yet needed. This write is called the forced output of a block; useful in recovery situations • Toss-immediate strategy: free the space occupied by a block as soon as the final tuple of that block has been processed
  • 10. Buffer Replacement Strategies • Most recently used (MRU) strategy: system must pin the block currently being processed. After the final tuple of that block has been processed the block is unpinned and becomes the most recently used block. This is essentially “toss-immediate” with pinning, and works very well with joins. • The buffer manager can often use other information (design or statistical) to predict the probability that a request will reference a particular page – e.g., the data dictionary is frequently accessed -- keep the data dictionary blocks in main memory buffer – if several pages are available for overwrite; choose the one that has the lowest number of recent access requests to replace
  • 11. Buffer Management (cont) • Existing OS affect DBMS operations by: – read ahead, write behind – wrong replacement strategies – Unix is not good for DBMS to run on top – Most commercial systems implement their own I/O on a raw disk partition • Variations of buffer allocation – common buffer pool for all relations – separate buffer pool for each relation – as above but with relations borrowing space from each other – prioritized buffers for very frequently accessed blocks, e.g. data dictionary
  • 12. Buffer Management (cont) • For each buffer the manager keeps the following: – which disk and which block it is in – whether the block is dirty (has been modified) or not (why?) – information for the replacement strategy • last time block was accessed • whether it is pinned • possible statistical information (access frequency etc.)
  • 13. Buffer Management and Disk-block Access Optimization (end) • Disk-block access methods must take care of some information within each block, as well as information about each block: – allocate records (tuples) within blocks – support record addressing by address and by value – support auxiliary (secondary indexing) file structures for more efficient processing • These concerns are linked in to our next topic: file organization.