week3 - CREATING A NEW FILE: CREATING EXHAUSTIVE READING IN...

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

View Full Document Right Arrow Icon
CREATING A NEW FILE: CREATING A NEW FILE: EXHAUSTIVE READING IN ORDER OF A FIELD: For the hospital file, it requires 194 hours>8 days
Background image of page 1

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

View Full DocumentRight Arrow Icon
REORGANIZING A SEQUENTIAL FILE: Why? The file may contain many deleted records. (Note that when we delete records, we mark them as deleted, but they stay in the file.) b(number of blocks) n(number of records)/Bfr(blocking factor) REORGANIZING WITH TWO DISK DRIVES: T Y = b * ebt Assumes that reading and writing are overlapped. HOW TO CREATE AN INTERSECTION FILE? n=100000 R=400 bytes 40 MB Method 1:
Background image of page 2
Read from F1 one by one and search F2 for the record read. Method 2: 1. 1. Read a large segment of records from F1 (10 MB). 2. 2. Compare each record in memory with all records in F2. Read F1 in terms of 4 segments. 4 seek time + 4 rotational latency time= 4*(16+8.3)= 97 ms. (negligible) To read 40 MB, 14 seconds is needed. To write out the common records, 0.7*14= 10 seconds is needed. 14+10=24 sec.
Background image of page 3

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

View Full DocumentRight Arrow Icon
EXAMPLES : 1. Suppose that a bank has 300 000 records each of which belongs to the individual customers. If the record size is 200 bytes, what will be the time to read through the entire file with independent fetches (time for exhaustive reading of the file)? (Block size for IBM 3380 is 2400 bytes and ebt is 0.84 ms.) Answer: Bfr = 2400 bytes/200 bytes = 12 T x = n*T F = n*[(n/Bfr)/2]*ebt = 300 000*[(300 000/12)/2]*0.84 = 3 150 000 000 ms. = 3 150 000 sec. ? 36.5 days 2. Suppose that we have two unordered sequential files records of which again belonging to customers. This time, however, distinct piles belong to distinct banks. Our aim in this question is to make the file belonging to common customers of these two banks. In other words, we are going to make the intersection file of these piles. Some additional information about the question can be listed as follows: Each of the unordered sequential files are composed of 300 000 records. 60 000 of these records (20%) are common in both files. Both of the files have 40 MB of data. So, what is the time required to make the intersection file? Answer: There are two methods for making intersection files. However, as the second one is more efficient than the first one, we will use this one.
Background image of page 4
First thing to do is to split the data of F 1 into 4 smaller segments each of which are 10 MB. Then comes reading the first segment into the memory and compare each record in memory with the records in F 2 . This process is repeated for all of the 4 segments. 4 seek time+4 rotational latency time= 4*(16+8.3)=97 ms. (negligible) In order to read 40 MB, we need 14 seconds. To read the common records, we need 14*0.2=2.8 sec. Then total time is, T.T. = 300 000*7+60 000*14= 2 940 000 sec. = 34 days SORTED SEQUENTIAL FILES: y: number of sorted blocks x: number of blocks in the overflow area(pile) x + y : total number of blocks ( x + y = b ) (b denotes the number of blocks) To find a record, one looks first in the main area. If the record is not in the main area,
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

week3 - CREATING A NEW FILE: CREATING EXHAUSTIVE READING IN...

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

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