Download presentation
Presentation is loading. Please wait.
Published byDennis Cross Modified over 9 years ago
1
CPSC 404 Assignment #1, Winter 2008 Term 2. Due: Wednesday, Feb 4, by 5 pm. Laks V.S. Lakshmanan
2
Q1: Consider a disk system with the following properties: There are 2^15 tracks on 4 double-sided platters. The disk spindle rotates at 3000 rpm. The arm assembly moves at the rate of 1 ms (set up) + 2^10 tracks/ms. Each track contains 80 sectors on an average. Answer the following: (a)What is the average seek time and average rotational delay? (b)What is the time taken to write data on a sector? (c)If this disk’s total capacity is 5,368,709,000 bytes, how much data can each sector store? (d)Which of the following are reasonable choices for a page size? : 100 bytes, 800 bytes, 1024 bytes, 4096 bytes, 20,480 bytes, 102,400 bytes. Justify your answer. Hint: Recall data is always read/written from/to disk in integral number of pages. How is a page related to a sector?
3
Q2: Assume the same properties for disk as in Q1. Assume 8 sectors are grouped into a page. Answer the following: (a)How many pages are there in the disk? (b)Consider a file containing records of 250 bytes each, stored on this disk without records straddling page boundaries. What is the largest file, in number of records, that can be stored on this disk? (c)How long will it take to read 1000 consecutive pages sequentially? (d)How long will it take to read 1000 pages at random, one by one? (e)This question does not depend on any particular disk: suppose there are 100,000 disk pages. The buffer manager adopts the LRU (i.e., least- recently-used) policy for buffer management. The buffer pool can fit 100 pages (frames) at a time. Suppose pages are requested in the order 1, 2, …, 100,000, 1, 2, …, 100,000, 1, 2, 100,000, 1, 2, … Show which page requests will be found in the buffer (i.e., hits) and which ones will have to be read afresh from the disk (i.e., misses or page faults). Show your work.
4
Q3: Consider a file containing 10 million song reviews: revid (10 bytes), sname (40 bytes), rating (2 bytes), comments (48 bytes). Suppose it is stored on a disk which features the following average times: seek = 7 ms, rotational delay = 8 ms, time to read/write a page = 0.5 ms. Page size is 4K. You have an available memory (i.e., buffer pool) of 25 M. (a)Explain in detail how you will sort this file on sname, minimizing the number of passes in phase II. Clearly state any assumptions you make. Your procedure should be as efficient as possible. (b)Estimate the time taken for your sorting procedure. Show your work. (c)Can you devise a strategy for sorting the file in situ, i.e., the sorted output is written on the space where the original file was stored and no additional disk storage is required during sorting? Why or why not? (d)Suppose you wish to allocate at least 10 pages per input buffer and for the output buffer in phase II. What is the smallest buffer pool which will let you sort the above file while minimizing the #passes in phase II? Show your work.
5
Q4: Consider a file containing 2^14 pages. Available memory (buffer pool) corresponds to 2^8 pages. Suppose on an average, a random I/O costs 8 ms (seek) and 7 ms (rotational delay). It takes 0.5 ms to read/write a page. (a)How many sorted sublists (SSLs) will be generated in phase I? (b)Derive the total time for the sort, assuming all SSLs are merged in one shot in phase II. (c)Repeat (b), assuming each of 2, 4, 32 SSLs are merged in at a time. When is overall sorting time the minimum?
6
Q5: Consider the relation Employees(Name, Address, Rank, Salary, Perks, yearOfHire) that contains 10 million tuples of 250 bytes each. Suppose we create a B+tree index on Name (primary key), which is 40 bytes long. Suppose we allocate 10 bytes for a pointer. Assume a page size of 4K and a buffer with 400 pages, and answer the following questions. (a)Show the structure of each internal node, showing the number of keys and pointers. Each node is to be implemented as a page. (b)What is the average number of children of an internal node of the B+tree above? Assume average capacity is approx. 66.5% of the maximum. (c)If you can prefetch parts of the B+tree into the buffer and keep them buffered, what is the minimum no. of I/Os will an equality search cost? Explain. (d)Based on the algorithms for handling insertions and deletions discussed in class, estimate the min and max no. of I/Os incurred by an insertion and by a deletion.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.