Assignment 1 - CS120a Due Tuesday, February 7, 10:40 AM ---------------------------------- 1. a) Compute r |x s (r semi-join s) for the relations shown below: +---+---+---+ +---+---+---+ | A | B | C | | C | D | E | +---+---+---+ +---+---+---+ | 1 | 2 | 3 | | 3 | 4 | 5 | | 4 | 5 | 6 | | 3 | 6 | 8 | | 1 | 2 | 4 | | 2 | 3 | 2 | | 5 | 3 | 2 | | 1 | 4 | 1 | | 8 | 9 | 7 | | 1 | 2 | 3 | +---+---+---+ +---+---+---+ r s b) For any relations t and u, under what conditions does (t |x u) = (u |x t)? Solution -------- a) r |x s = +---+---+---+ | A | B | C | +---+---+---+ | 1 | 2 | 3 | | 5 | 3 | 2 | +---+---+---+ b) (t |x u) = (u |x t) only if the schemas for t and u are the same 2. Suppose a 10 Mbps (megabits per second) network transmits 1024 byte packets that include 132 bytes of headers and trailer. If a workstation on the LAN is guaranteed to be able to transmit at least one packet every X time units (since the network is shared with other workstations), what maximum amount of time, as a function of X, should be required (based only on these factors) to transfer a 3 MB file from a server to a workstation? What is the effective transfer rate from the server to the workstation? Solution -------- Given a 3 MB file to transfer, it means that there are 3,145,728 bytes to transmit. Each 1,024 byte packet has 132 bytes of overhead, leaving 892 bytes to carry data. This means that 3,527 packets must be sent to transmit the file. Since one packet can be sent every X time units, the time to transmit the file is 3,527X. The effective transfer rate is therefore: 3,145,728 / 3,527 X = 891.9 bytes per X time units 3. A disk is being utilized 30% of the time, and the average time to service a disk request is 20 msec. If on average, 60 disk requests are being serviced or in the queue at any one time, what is the average response time per disk request? Solution -------- Disk Utilization (U_d) = 30% Average Service time (S_d) = 20 msec Therefore: Disk Throughput (X_d) = U_d / S_d = .3 / .002 = 150 / sec (UL) Average number of requests being serviced (N_d) = 60 Therefore: Response time (R_d) = N_d / X_d = 60 / 150 = 0.4 sec (LL) 4. Consider a RAID-7 disk that distributes data across 6 disks (i.e., a stripe group consists of 6 stripe units), leaving one disk for storing the parity. For n = 1, 2, 3, 4, 5 and 6, compute the minimum number of stripe units (rw (n)) that must be read as a result of a request to write n stripe units, so as to update parity. Explain each of your answers. Solution -------- n rw (n) Reason - ------ ------ 1 2 Read old value of stripe unit and parity 2 3 Read old values of stripe units and parity 3 3 Read remaining (unwritten) stripe units 4 2 Read remaining (unwritten) stripe units 5 1 Read remaining (unwritten) stripe units 6 0 - 5. To allow for greater enrollment without adding building space, the Brandeis Computer Science department adds an internship component to its undergraduate degree. Under this program, students work in industry for one semester for every two semesters that they take courses. Suppose that on average, 100 students do an internship every semester, and that on average, students complete their degree (including internships) in 6 years. a) On average, how many students graduate the program every semester? b) On average, how many students are enrolled in Computer Science at the start of a semester? (You may assume that the average number of new enrollments each semester is equal to the number of graduating students each semester.) Solution -------- a) Students complete their degree in 6 years. Therefore, 4 of these years are spent doing courses and 2 are spent doing internships. Given that a "visit" to the CS department requires 1.5 years (1 year for courses and 0.5 years for internship), students on average make 4 "visits" to the CS department (i.e., V_CS = 4). We are given that X_CS = 100. Therefore, the average number of graduating students is: X_0 = X_CS / V_CS (FFL) = 100 / 4 = 25 b) Let N_Degree be the average number of students enrolled for the CS undergraduate degree. From a), we know that X_Degree = 25 students graduate on average every semester, and we are given that R_Degree = 6 years = 12 semesters. Therefore,by Little's Law we have: N_Degree = X_Degree * R_Degree = 25 * 12 = 300