0% found this document useful (0 votes)
7 views3 pages

DBMS Chapter9 Exercise Answers

Uploaded by

Nit Hish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

DBMS Chapter9 Exercise Answers

Uploaded by

Nit Hish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS Chapter 9 - Exercise Question

Answers
Exercise 9.1
The most important difference between a disk and a tape is that disks support direct
(random) access while tapes only support sequential access. This makes disks significantly
faster and more suitable for DBMS workloads where frequent and random access to data is
needed.

Exercise 9.2
Seek time: The time taken by the disk arm to move the heads to the track where the data is
stored.
Rotational delay: The time it takes for the desired sector of the disk to rotate under the
read-write head.
Transfer time: The time taken to actually transfer data once the read-write head is
positioned correctly.

Exercise 9.3
Besides faster access, the key difference is the nature of volatility. Main memory is volatile
and loses data on power loss. In contrast, disk maintains persistence, retaining data even
after a power failure, which is essential for data durability in DBMS.

Exercise 9.4
To store a frequently scanned sequential file, pages should be stored in contiguous disk
blocks. Additionally, placing these blocks on the outer tracks can increase transfer rates due
to higher data density.

Exercise 9.5
1. Capacity of a track = 512 bytes/sector * 50 sectors = 25,600 bytes
Capacity per surface = 25,600 bytes * 2000 tracks = 51,200,000 bytes (51.2 MB)
Total capacity = 51.2 MB * 10 surfaces = 512 MB
2. Number of cylinders = 2000 (equal to number of tracks per surface)
3. Valid block sizes must be a multiple of 512 bytes. So, 256 is invalid, 2048 and 51200 are
valid.
4. Max rotational delay = 1 rotation = 60 sec / 5400 rpm = 11.11 ms
5. Transfer rate = 25,600 bytes per 11.11 ms ≈ 2.3 MB/sec

Exercise 9.6
1. 1024 / 100 = 10 records per block
2. 100,000 / 10 = 10,000 blocks. One surface holds 2000 tracks * 50 blocks = 100,000 blocks
(each track has 50 blocks), so 1 surface is sufficient.
3. 512 MB / 100 = 5,242,880 records
4. Block 1 of track 1 on next surface would hold page 2 if not parallel. If heads operate in
parallel, all block 1s on each surface can be read simultaneously.
5. Sequential read = 10,000 blocks * 11.11 ms ≈ 111 sec (if no parallelism). With parallel
heads, ≈ 11.1 sec.
6. Random read = 10,000 * (seek + rotational delay) = 10,000 * (10 + 5.5) ms ≈ 155 seconds.

Exercise 9.7
If a page is in the buffer but not pinned, it can be reused by another process. If pinned, it
means it's actively being used and cannot be replaced or flushed.

Exercise 9.8
A buffer manager writes a page to disk when:
- The page is dirty and chosen for replacement.
- During checkpoints.
- When explicitly forced by a transaction commit or WAL requirement.

Exercise 9.9
A page is 'pinned' when in use by a transaction. It's unpinned when the operation is
completed. DBMS is responsible for pinning and unpinning via the buffer manager.

Exercise 9.10
When a page is modified, it's marked dirty. The buffer manager ensures it is flushed to disk
(write-back) when required — typically during replacement or commit. WAL ensures
changes are logged before they’re flushed.

Exercise 9.11
If all pages in the buffer are dirty, one must be written back to disk before replacement. This
can introduce delays unless writes are proactively managed.

Exercise 9.12
Sequential flooding occurs when a large sequential scan displaces all pages in the buffer
pool, pushing out other useful pages. LRU replacement policies are especially susceptible to
this issue.

Exercise 9.13
DBMS buffer managers support pinning, prefetching, forced writes, and management
policies tailored to query patterns — which typical OS buffer managers don’t provide.

Exercise 9.14
Prefetching is the act of loading pages before they are explicitly requested, based on
anticipated access patterns. It helps reduce wait times and improves sequential access
efficiency.
Exercise 9.15
1. Disk-controlled prefetching may not align with DBMS’s knowledge of query plans.
2. Multiple queries with different access patterns may evict each other’s pages.
3. DBMS-managed prefetching is context-aware and smarter.
4. Segmented disk caches help but don’t eliminate the need for DBMS prefetching.

Exercise 9.16
Two record formats:
1. Fixed-length: Simple and fast but wastes space with variable-length fields.
2. Variable-length with offsets: Space-efficient and flexible but requires more complex
access logic.

Exercise 9.17
Two page formats:
1. Slotted pages: Allow record movement, support variable-length records.
2. Fixed layout: Simple and fast but inflexible to changes.
Trade-off: Slotted pages are more flexible, fixed pages are faster.

Exercise 9.18
1. Fixed-size directory is simple but wastes space and limits capacity.
2. Sorting can be achieved by rearranging slot pointers rather than records, preserving
record IDs.

Exercise 9.19
1. List-based: Simple but hard to search; Directory-based: Easier navigation, scales better.
Directory preferred for variable-length.
2. Use slotted pages that can link to either full or free-space lists.

Exercise 9.20
1. All-pages and free-space pages list gives fast traversal but wastes memory. Full and free-
space pages list is more memory-efficient.
2. Use a slotted page layout with space tracking metadata.

Exercise 9.21
1. Place on inner track to reduce contention.
2. Outer track to benefit from higher sequential throughput.
3. Spread across mid-to-outer tracks for balanced access.
4. Outer tracks for best performance.

Exercise 9.22
Pin count tracks how many processes are using a page. A simple flag would not handle
multiple concurrent accesses correctly, whereas a count allows accurate tracking.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy