CS351HW2-Fall2009.Sol2

CS351HW2-Fall2009.Sol2 - Safa Eriti Sec03 CS 351 Homework 2...

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

View Full Document Right Arrow Icon
Safa Eri ş ti Sec03 1 | Page CS 351 – Homework 2 Answer 1. a) On IBM 3380, we have 20 blocks of 2400 bytes on each track. The question gives that it takes 0.5 times the read time to process one block of data. This means it also takes 0.5 times the read time to process one track. To illustrate; I/O Cpu Read 1 st Read 2 nd Process 1 Read 2 nd Read 3 rd Process 2 Read 3 rd Read 4 th Process 3 Read 4 th Read 5 th Process 4 In this example I/O time is larger than CPU time and since there is overlapping. We only need to calculate the I/O time. The time it takes to read one track is; 20*ebt (neglecting the s+r) We have b number of blocks, it means it covers b/20 number of tracks. So the total time is: b/20 * [ 20 * ebt] = b * ebt b) In this case it takes 1.5 times the read time to process one block of data. Meaning that it takes 1.5 times the read time to process one track. In this scenario, CPU time is larger than I/O time. Since we do overlapping, we can ignore I/O time. So the total time is; b/20 *[3/2 * 20 * ebt] = 1.5 * b * ebt Answer 2. To find the exact number, I will use IBM 3380’s specifications. To find the time for reorganization the formula is; Ty = (b+n/Bfr) * ebt. For every 3 record we add we delete one record. So it means that when we have 150.000 record, we will have 25000 records marked as deleted. Bfr = 2400/400 = 6. If we plug in the numbers we get Ty = (175,000/6 + 150,000/6)* 0.84 = 45,500ms First Buffer Second Buffer 1 1 1 2 1 2 3 2 3 2 3 4
Background image of page 1

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

View Full DocumentRight Arrow Icon
Safa Eri ş ti Sec03 2 | Page Before reorganizing, we had 175,000, so It takes (175,000/6) * 0.84/2 = 12250ms to fetch After reorganizing we have 150,000 records. So it takes (150,000/6) * 0.84/2 = 105000ms to fetch Answer 3. We are asked to print total population of a town within a county, total population of a county within a city and total population of a city. First, we open 2-dimensional array in the memory and We start processing the file, for every unique we add instance to the array. Whenever we come across a record with same city, county and town, we add its population to the existing population. For example let the first record be Artvin, Ş av ş at, YavuzKöy, Ahmetler with 200 population, we have And let the 10 th record be Then in the memory we would have After finishing processing the file we will only deal with
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.

This note was uploaded on 12/01/2011 for the course CS 351 taught by Professor Fazlıcan during the Spring '11 term at Bilkent University.

Page1 / 10

CS351HW2-Fall2009.Sol2 - Safa Eriti Sec03 CS 351 Homework 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online