A7-Ting Wei Chien(Willy)

.docx

School

Santa Clara University *

*We aren’t endorsed by this school

Course

443

Subject

Computer Science

Date

Jun 11, 2024

Type

docx

Pages

2

Uploaded by CaptainMorningDonkey44

CS443 - Assignment 7 Ting Wei Chien Question 1: Consider a disk with the following characteristics: block size B=512 bytes, interblock gap size G=28 bytes, number of blocks per track=20, number of tracks per surface=400. A disk pack consists of 16 double-sided disks. (a) Question its useful capacity (excluding interlock gaps)? - What is the total capacity of a track o 20*512 = ? 10240 bytes - What is the total capacity of a track o 20 * (512+28) = ? 10800 bytes (b) How many cylinders are there? Total cylinders = total number of tracks = 400 . (c) What is the total capacity and the useful capacity of a cylinder? Total capacity of a cylinder: double-sides disks * total capacity = 16 * 2 * 10800 = 345600 bytes Useful capacity of a cylinder: double-sides disks * useful capacity = 16 * 2 * 10240 = 327680 bytes (d) What is the total capacity and the useful capacity of a disk pack? Total disk pack capacity: total tracks * total cylinders capacity = 400 * 345600 = 138240000 bytes Useful disk pack capacity: total tracks * useful cylinders capacity = 400 * 327680 = 131072000 bytes (e) Suppose the disk drive rotates the disk pack at a speed of 2400 rpm (revolutions per minute); what is the transfer rate (tr) in bytes/msec and the block transfer time (btt) in msec? What is the average rotational delay (rd) in msec? What is the bulk transfer rate (btr)? Transfer rate: total capacity / disk revolution time in msec = 10800 / ((60 * 1000) / 2400) = 432 bytes/msec Block transfer time: block size / transfer rate = 512 / 432 = 1.185185185 msec Average rotational delay: disk revolution time in msec /2 = ((60 * 1000) / 2400) /2 = 12.5 msec Bulk transfer rate: (block size /( block size + gap size)) * transfer rate = 409.6 bytes/msec (f) Suppose the average seek time is 20 msec. How much time does it take (on the average) in msec to locate and transfer a single block given its block address? seek time + rotational delay + Block transfer time = 20 + 12.5 + 1.185185185 = 33.68518519 msec (g) Calculate the average time it would take to transfer 20 random blocks (may not be on the same cylinder) and compare it with the time it would take to transfer 20 consecutive blocks (all in on cylinder). Average time to transfer 20 random blocks: 20 * (s + rd + btt) = 673.7037038 msec
Average time to transfer 20 consecutive blocks: s + rd + 20 * btt = 56.2037037 msec Question 2: A file has r=400,000 STUDENT records of fixed-length. Each record has the following fields: NAME (30 bytes), SSN (9 bytes), ADDRESS (40 bytes), PHONE (12 bytes), BIRTHDATE (8 bytes), SEX (1 byte), MAJORDEPTCODE (3 bytes), MINORDEPTCODE (4 bytes), CLASSCODE (4 bytes, integer), and DEGREEPROGRAM (3 bytes). An additional byte is used as a deletion marker. The file is stored on the disk whose parameters are given in Question 1. (a) Calculate the record size R in bytes. (NAME + SSN + ADDRESS + PHONE + BIRTHDATE + SEX + MAJORDEPTCODE + MINORDEPTCODE + CLASSCODE + DEGREEPROGRAM) + 1 = 30 + 9 + 40 +12 +8 + 1 + 3 + 4 + 4 + 3 + 1 = 115 bytes (b) Calculate the blocking factor (bfr) and the number of file blocks b assuming an unscanned organization. blocking factor: floor ((512 / 115)) = 4 records per block file blocks b: ceiling ((400000 / blocking factor)) = 100000 blocks (c) Calculate the average time it takes to find a record by doing a linear search on the file if 1. the file blocks are stored contiguously, and file blocks are stored contiguously: s + rd + (k * btt) = 20 +12.5 + ((100000 / 2) *1.185185185) = 59291.75925 msec 2. if the file blocks are not stored contiguously. file blocks are not stored contiguously.: k * (s + rd + btt) = 1684259.26 msec (d) Assume the file is ordered by SSN; calculate the time it takes to search for a record given its SSN value by doing a binary search. Ceiling((log2(100000) * (s + rd + btt)) = 16.609 * 33.68518519 = 559.4772 -> 560 msec
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help