IC411 Homework, Chapter 1 Spring 2017 Name ____________________________ Total points: 217 Chapter 1 (10) 1. (text 1.1) List and define the two main functions of an operating system. (10) 2. Multiprogramming is described as the “central theme of modern operating systems.” Explain what multiprogramming is and why it is useful? (10) 3. (text 1.3) How do timesharing systems differ from multiprogramming systems? (10) 4. (text 1.10) What is the difference between kernel and user mode? Explain how having two distinct modes aids in the design of an operating system? (10) 5. Could an OS be designed with more than two modes? If not, why not? If so, how? Assume that any processor architecture could be used. (10) 6. Explain the difference between a mode switch and a context switch, in your own words. When does each occur? (9) 7. (text 1.13) Consider a system that has two CPUs, each CPU having two threads (hyperthreading). Suppose three programs, P0, P1, and P2, are started with run times of 5, 10, and 20 ms, respectively. How long will it take to complete the execution of these programs? How long will it take to complete the execution of these programs? Assume that all three programs are 100% CPU bound, do not block during execution, and do not change CPUs once assigned. What if: If P0 and P1 are scheduled on the same CPU and P2 is scheduled on the other CPU If P0 and P2 are scheduled on the same CPU and P1 is scheduled on the other CPU If P1 and P2 are scheduled on the same CPU and P0 is scheduled on the other CPU (10) 8. (text 1.15) Consider a computer system that has cache memory, main memory (RAM), and disk, and an OS that uses virtual memory. It takes 1ns to access a word from the cache, 10ns to access a word from RAM, and 10ms to access a word from the disk. Assuming the cache hit rate is 95% and the main memoir hit rate (after a cache miss) is 99%, what is the average time to access a word? (10) 9. What is the distinction between spatial locality and temporal locality? (10) 10. What is an interrupt (hardware or software) and how does it affect normal control execution of a program? (10) 11. How are interrupts related to system calls? (5) 12. In the memory hierarchy, explain what spatial locality refers to. (5) 13. In the memory hierarchy, explain what temporal locality refers to. (5) 14. In general, what is a strategy for exploiting spatial locality? (5) 15. In general, what is a strategy for exploiting temporal locality? (10) 16. A computer has a cache, main memory, and a disk used for virtual memory. If a referenced word is in the cache, 20ns are required to access it. If it is in main memory but not in the cache, 60ns are needed to load it into the cache (this includes the time to originally check the cache), and then the reference is started again. If the word is not in main memory, 12ms are required to fetch the word from disk, followed by 60ns to copy it to the cache, and then the reference is started again. The cache hit ratio is 0.9 and the main-memory hit ratio is 0.6. What is the average time in ns required to access a referenced word on the system? (10) 17. Explain the difference between a monolithic kernel and a microkernel. (10) 18. What is multithreading? How does it differ from multiprogramming? (8) 19. (text 1.33) Unit conversion practice problems: (a) How long is a year, in nanoseconds? (b) Micrometers are often called microns. How long is a megamicron? (c) How many bytes are there in a 1PB memory? (d) The mass of the earth is 6,000 yottagrams. What is that in kilograms? (10) 20. In terms of program compilation, what is linking, generally? (10) 21. What are the differences between static linking and dynamic linking, and what are the pros and cons of each? (10) 22. In terms of program execution, what is loading, generally? (10) 23. What is the key difference between a hardware interrupt and a software interrupt? (10) 24. How does an exception differ from an interrupt?