



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Submission Steps: (1) YOUR NETID MUST BE AT THE TOP OF EVERY PAGE; (2) PROVIDE THE SOLUTION IN HARD COPY – DO NOT USE HANDWRITTING; (3) START EACH OF THE FOUR PROBLEMS ON A NEW PAGE – IT WILL MAKE THE GRADING PROCESS MUCH FASTER!! (3) BRING THE HARD COPY HW2 SOLUTION TO ANDA OHLSSON’S OFFICE, 3120 SIEBEL CENTER BY WEDNESDAY, May 2, 4PM
Problem Points Grader Problem 1 / Problem 2 / Problem 3 / Problem 4 / Total /
1. Problem on Input/Output (25 Points)
1A. (9 Points) Although DMA does not use the CPU, the maximum transfer rate is still limited. Consider reading a block from the disk. Name three factors that might ultimately limit the rate transfer.
1B. (6 Points) An alternative to interrupts is polling. What are the circumstances in which polling is better than interrupts? Give at least two circumstances.
1C. (10Points) Let us assume a disk with rotational speed of 15,000 rpm, 512 bytes per sector, 400 sectors per track and 1000 tracks on the disk, average seek time is 4ms. We want to transmit a file of size 1 MByte, that is stored contiguously on the disk. What is the transfer time for this file? What is the average access time for this file? What is the rotational delay in this case? What is the total time to read 1 sector? What is the total time to read 1 track?
3. Problem on Virtual Memory (25 Points)
3A. (15 Points) A process has four page frames allocated to it (All the following numbers are decimal, and everything is numbered starting from zero). The time of the last loading of a page into each page frame, the time of last access to the page in each page frame, the virtual page number in each page frame, and the referenced (R) and modified (M) bits for each page frame are as shown in the table below (the times are in clock ticks from the process start at time 0 to the event – not the number of ticks since the event to the present).
Virtual page number
Page frame Time loaded Time referenced
R bit M Bit
2 0 60 161 0 1 1 1 130 160 1 0 0 2 26 162 1 0 3 3 20 163 1 1
A page fault to virtual page 4 has occurred at time 164. Which page frame will have its contents replaced for each of the following memory management policies? Explain why in each case: (a) FIFO (b) LRU (c) Optimal (Use the following virtual page reference string before the page fault to virtual page 4 occurred : 4,0,0,0,2,4,2,1,0,3,2) (d) How many page faults would occur if the working set policy with LRU were used with a window size of 4 (use the future virtual page reference string, starting before the page fault to virtual page 4 occur 4,0,0,0,2,4,2,1,0,3,2). Start counting page faults with the page fault of page 4.
3B. (10 Points) Consider the following page table below. All numbers are decimal, everything is numbered starting from zero, and all addresses are memory byte addresses. The page size is 1024 bytes and the processor architecture is 32-bit.
Virtual page # Valid Bit Reference Bit Dirty Bit Page frame # 0 1 1 0 4 1 1 0 1 7 2 0 0 0 - 3 1 0 0 2 4 0 0 0 - 5 1 0 1 0
a. (5 Points) Describe exactly how, in general, a virtual address generated by the CPU is translated into a physical main memory address? Your answer should explain how the Valid, Reference and Dirty bits are used or set.
b. (5 Points) What physical address, if any, would each of the following virtual addresses correspond to? (do not try to handle any page faults if any). Note that the addresses are decimal addresses, not hexadecimal. addresses i. 1052 ii. 2221 iii. 5499
4C. (12 Points) Let us consider the following shell commands on a local inode-based file system. cd /tmp mkdir subdir echo "hello" > subdir/file ln -s subdir/file1 file ln -s subdir/file1 file ln subdir/file1 file ln file4 file chmod 744 file touch file rm file chmod 000 subdir
a) How many disk blocks were allocated in total? b) How many disk blocks were freed in total? c) Which command(s) incremented or decremented an existing inode reference count? d) Describe in words the permissions on the file ' file4 ' e) Identify the last command to modify the inode of ' file3 ' and describe which inode field is modified. f) Describe the indirect effect (if any) of the 'chmod 000. ' command on the files file1,file2,file3,file.