Sie sind auf Seite 1von 4

NAME________________________________________ e-mail (if different from one on file)_________________ CS1550 exam, 1:15 hours.

Your grades (exam and final grade) will be emailed by Friday; Friday I will be in my office for you to review your exam, if needed. After Friday, you must file a written request for re-grading. Memory subsystem and virtual memory: 1. 2. 3. [3 pts] The per process external fragmentation of a paging system is, on average, equal to: zero [3 pts] First-fit, next-fit, and best-fit algorithms are examples of algorithms for _________________________ Dynamic partitions and segmentation [3 pts] Which memory allocation scheme has poor performance with respect to random reads and writes of files: a) linked b) indexed c) contiguous d) none of the above [10 pts] Page replacement algorithms (PRAs) Give an example of a good PRA, except Least Recently Used (LRU). Describe why this is a good approximation to the optimal, what does it need in terms of specialized hardware (if anything), what is the software part, and what are the overheads associated with this algorithm.

4.

software for all of them includes clearing the reference bit periodically; all are based on locality of reference (keeping pages most recently used) Clock Aging (or modified NFU) Working Set Modified FIFO, tried to keep old, unused pages, out of the memory Ages pages and replaces the oldest one Attempts to classify pages into needed by the process and not. Easier to implement than WS, and the same principles (needed pages have priority) A reference and dirty bit that are set set for every page access A set of bits that are shifted at every page access A timestamp and a reference bit that are set set for every page access A timestamp, a reference and dirty bit that are set set for every page access A FIFO circular queue

WS Clock

Scan thru the page table to find old entries A FIFO circular queue and scanning thru the list

[7 pts] How many disk accesses are necessary for reading byte 4K of a file that has not been opened yet? Assume that the directory has been read and it is cached in memory. Explain why. 2. Because the directory is already read, need to read the i-node to get the direct pointer that contains the address of sector (assume that each sector is bigger than 1K). The second disk access is for reading the data itself.

5.

6.

[7 pts] Consider a system with three page frames for user-level applications, and consider the following reference string: 5 6 9 3 5 6 3 6 9 4 3 9 6 4 9. How many page faults will there be, when one considers FIFO, LRU, and the optimal page replacement algorithms? The answers below include the initial page faults (those caused when the memory is empty). If FIFO is used there will be 11 pagefaults. The accesses would go like this. 3 page faults initially to have 5, 6, 9 in memory. Then 5 is replaced by 3, 6 by 5, 9 by 6. No page faults on 3 and 6. 3 is replaced by 9, 5 by 4, and 6 by 3. No page fault on 9. 9 is replaced by 6. No page fault on 4. 4 is replaced by 9. Total 11 pagefaults. If LRU is used there will be 11 pagefaults. The accesses would go like this. 3 page faults initially to have 5, 6, 9 in memory. Then 5 is replaced by 3, 6 by 5, 9 by 6. No page faults on 3 and 6. 5 is replaced by 9, 3 by 4, and 6 by 3. No page fault on 9. 4 is replaced by 6, 3 by 4 and no page fault on 9. Total 11 page faults. If OPT is used there will be 7 pagefaults. 3 pagefaults initially to have 5, 6, 9 in memory. 9 is replaced by 3. No page faults on 5, 6, 3, and 6. 5 is replaced by 9, 6 by 4. No page faults on 3 and 9. 3 is replaced by 6. No page faults on 4 and 9. Total 7 page faults. [5 pts] Let there be a set of processes that has a very large Virtual address space (say 232 bytes), but in fact only uses the first 4 pages and the last 4 pages. If all processes are like this in your system, design a page table that requires the smallest amount of page table space? Explain your design choice? Best is n-level page table, where n>1. N=2 is acceptable, n=3 is better. Bigger n means smaller page tables, which would fit in the TLB. Too many levels means that there will be too much overhead in translation between virtual and physical addresses.

7.

8.

[5 pts] How is page fault frequency (or any such models) related to degree of multiprogramming of a computer? The higher the page fault frequency, the more thrashing. This means that there is not enough memory to allow for so many processes and therefore the degree of multiprogramming should be decreased.

IO systems 9. [5 pts] Assume that a system has a DMA to perform the block transfers from disk to main memory. Assume that the disk has finished transferring 1K words of data to the controller memory at time t=0. At t=0 also, the CPU starts a process that will make sequential memory accesses every other bus cycle (that is, the CPU keeps the bus occupied 50% of the time to read a block of 1K words). Assume that the memory bus is shared by the CPU, DMA, disk, and memory. Also assume that only one word can be transferred at a time via the memory bus. How would you design your system to maximize performance for this very particular case? All memory accesses of the CPU goes through a cache. In this case, all the cache needs to do is to pre-fetch 1K words of data upon the first memory access to that block of data. Once the cache completes its pre-fetch operation, the bus can be granted to the DMA to complete its operation.

10. [3 pts] What is the sequence of events that happen at the completion of an IO operation? Start at the device. Device device controller interrupt handler device driver operating system (unblock process) user process resumes

In questions 9-11, mark (a) TRUE (b) FALSE 11. [2 pts] All interrupts can be masked by the system (i.e., all devices are prevented from interrupting the CPU). FALSE. There is a NMI (non maskable interrupt that cannot be masked by the system.) 12. An interrupt controller (PIC) arbitrates among interrupts. If an interrupt is being handled: a. [2 pts] Higher priority interrupts are only able to be executed after the current interrupt is done. FALSE b. [2 pts] Interrupts at the same priority are able execute immediately. FALSE

13. [2 pts] Interleaving is done in order to accommodate different densities in the disk inner/outer tracks. FALSE. 14. [2 pts] Interrupt handler is not allowed to disable all interrupts, otherwise the process that was interrupted will never execute again and there will be a deadlock. FALSE. The interrupt handlers are allowed to disable interrupts and may in fact need to disable interrupts. However, the interrupt handlers reside in device drivers or kernel and hence can be ensured to enable interrupts once they are done with their work.

Disk allocation/management and file systems: In questions 14-16, mark (a) TRUE (b) FALSE 15. [2 pts] The interrupt service routine is the part of the operating system that handles DMAs. FALSE. 16. [2 pts] Disk blocks can always be relocated (like the organ pipe distribution or other dynamic rearrangement of data) at any time with acceptable overhead, since they are small blocks of data. FALSE. It depends on the number of disk blocks being moved. 17. [2 pts] RAIDs allow for both fault-tolerance (due to redundancy) and fast access to data on disks, compared with a single disk. TRUE. 18. [4 pts] Give an example where the organ pipe distribution of data increases the seek delays when compared with FIFO data placement algorithms. There are specific instances such as when the head has to traverse back and forth from one end of the disk to another, when the organ pipe distribution may not be very good. 19. [3 pts] The temporal overhead of log-based file systems (LFS) is mainly due to: Having to do compaction and garbage collection when the disk is full (regardless of the utilization of the disk)

20. [10 pts] Let there be a user whose main file system usage is constantly (a) listening to MP3s (legal, of course!), (b) browsing the web, and (c) sending/receiving emails. Every message and every webpage (all files) get cached in the local disk. Cached files for web browsing are deleted periodically (every T time units). a. Create two designs for this users file system (the best one you can think of, and another one); b. describe what type of file system structure, the type of file allocation strategy, and the disk scheduling algorithm you would use.

c.

Compare your two designs showing advantages of each design (hopefully your best design will have more advantages than your other design!)

Dedicate some buffers for caching the MP3 tracks and prefetch them. Rearrangment of disk blocks to allow for whole tracks to be dedicated to MP3s is a good idea. Index allocation due to the frequency of request that are not sequential reads/writes (like the web and email requests). Disk scheduling should be any SCAN or LOOK or elevator algorithms. Just no FIFO. Bonus points for people who say that theyll have two queues and will put the MP3 requests in higherpriority queue. Alternative design: anything goes :-)

Das könnte Ihnen auch gefallen