{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

fa09_cs433_hw6_sol - CS433 Computer Systems Organization...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS433: Computer Systems Organization Fall 2009 Homework 6 Assigned: Nov/30 Due in class Dec/8 Total points: 40 points. Instructions: Please write your name, NetID and an alias on your homework submissions for posting grades (If you don’t want your grades posted, then don’t write an alias). We will use this alias throughout the semester. Homeworks are due in class on the date posted.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1. Disk Performance [10 points] Consider the following hard drive: Seek Time 8 ms Rotation Speed 7200 rpm Transfer Rate 80 MB/s Controller Overhead 0.1 ms Sector Size 512 Bytes (a) We have a 1 MB binary file stored on a single track. The file contains sorted key/value pairs. Each pair consists of two integers. The first integer is the key and the second is its corresponding value. Integers are 4 bytes long. Assuming the integer key we are searching for is contained within the file, calculate the average time needed to find its corresponding value using sequential search. Assume the only significant factor in the search time is the time to transfer sectors from disk (once transfered to memory, the time needed for to process each record is negligible).Assume we can process the file as we read. On average, how long does it take to find a key/value pair on the hard disk? [6 points] Solution: On average, well have to sequentially read through half the file before we find the key/value pair. This means well have to read 512 KB. Totaltime = seektime + rotationdelay + transfertime + overhead time = 8ms+ (60000ms/1min) × (1min/7200rotations) ×.5rotation+ (1000ms/80MB) ×0.5MB +0.1ms = 8ms+4.17ms+ 6.25ms + 0.1ms = 18.52ms 4 point for work. 2 point for answer. (b) What would be the worst case time needed if we used binary search? [4 points] Solution: The file holds 1MB × 1024 × 1024/8 = 131072 key/value pairs. If we used the binary search, it would take on average, log2131072 = 17 accesses. However, the last 64 key/value pairs are all within the same 512 Bytes sector. So the last log2(64) = 6 accesses are all within the same sector, so effectively only one disk read is necessary for these last 6 accesses. That means there are a total of 12 reads. There are two possible solutions depending on the assumptions: (1) Time taken to read one sector = 8+0.5*60*1000/7200+512*1000/(2 20 * 80)+0.1 = 12.27ms Hence, time required to read 12 sectors = 12*12.27 = 147.2ms.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}