* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Test1: Spring 2017 (Hint)
Survey
Document related concepts
Transcript
Test 1 CS330 Operating Systems and Networking Spring 2017 Time: 1 hour and 50 minutes Q1A. One of the claims for Operating Systems is that it provides a set of services to system users. Who could possibly be its users? What set of services do the users require and do receive from its Operating systems? Ans. The users of an OS are: processes (and threads) including the kernel processes. The set of services: provision of a virtual machine to each every user using the OS, running processes, resource allocation and management, scheduling and management of concurrency, networking, storage, etc. Or, Q1B. The following attempts to depict an architectural view of a computer system. However, it might flawed to say the least. What are its major set of flaws, if any? CPU CPU CACHE MMU MEMORY DMA Ans. Since CPU cache must be within CPU and the MMU must be able to receive instruction from CPU directly, it must be connected to CPU directly. Memory should be accessible independently via the system Bus. Q2A. Operating systems could be described architecturally as monolithic in design. What are the advantages and disadvantages of monolithic designs? Ans. Advantages of monolithic OS: Faster, everything is within kernel, and therefore safer, low overhead, data sharing among modules via interfaces, communication via shared memory. Disadvantages: Big, any bug in one part of the kernel could crash the entire system. Difficult to locate and repair faults. Addition of a new kernel routine is a hassle. Or, Q2B. Operating systems could be described architecturally as microkernel in design. What are the advantages and disadvantages of microkernel architecture? Ans. . Advantages of microkernel OS: Most of the services are in user area including device drivers, easy to extend the system pushing more kernel additions in the user area, more reliable kernel code since its modular and smaller, thin kernel, communication via message passing, users can individually crash without bringing the entire system down, and easier to port. Disadvantages: System calls are expensive, slower compared to monolithic ones. Poor performance is the issue. Q3A. What role does an interrupt routine play? Describe the sequence of operations CPU must carry out when it fields an interrupt. How does the system handle a second interrupt while it is busy attending the first interrupt? Ans. An interrupt routine is a CPU state changer – whatever a CPU were doing would be first stopped. Upon receiving an interrupt signal, the CPU goes through the following ■ stop the current running process. ■ execute a context switch, update the last process’ PCB unit, return it to the head of the ready queue. ■ load the interrupt handler, copy its priority value, run it. ■ act on the interrupted process as required by the interrupt handler routine. If one or more interrupts are received while executing the last interrupt routine, ■ check its priority. If higher, execute this first depositing the last interrupt on a stack. Otherwise, put it in a FIFO queue to be executed subsequently. Or, Q3B. A DMA scheme provides one approach to do I/O by device controllers. What is DMA? How is it distinguished from the other possible ways of doing I/O? Ans. A DMA is used when a device controller directly dumps input from an external source into a specific location in RAM, or directly output from a RAM location into an output unit sparing the CPU. DMA issues only a single completion interrupt to CPU when it finishes. In other ways of doing I/O either the processor needs to wait for I/O to finish, or it would be fielding an unnecessary barrage of interrupts from the I/O processor. Q4A. Under what circumstances would a user be better off using a time-sharing system than a PC? Discuss the issue. Ans. . A multi-tasking time-sharing system is more powerful than a PC. What could take a large amount of time on a PC would take often a fraction of the time on a time-sharing system even with context switching. Therefore, for large time consuming compute bound processes it would be better to run them on a time-sharing system. Or, Q4B. Describe the differences among the short-term, medium term and long-term scheduling. For a process accepted for running, which one is the most frequent and which one is the least frequent event? Ans. Short-term scheduling is CPU scheduling particularly in a time-sharing system. Long-term scheduling is when a job first enters the system in the memory queue for a chunk of memory to become a process. Since this is a long-term commitment for a process, it is termed as Long-term scheduling. The medium term scheduling begins when a process is suspended by the MMU to a swap disk. Q5A. Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in order)?Which algorithm makes the most efficient use of memory? Ans. We label the incoming processes each via a distinct pair (Name, Memory needed). Accordingly, the processes are: (A,212), (B,417), (C,112), and (D,426). The memory blocks are shown after allocation as follows: First Fit: A → (500 KB) leaving a hole of size 288 B → (600 KB) leaving a hole of size 183 C → (288 KB hole) leaving a hole of size 176. D is too large under this scheme, and therefore cannot get any memory. Do the similar allocation with Best Fit, and Worst Fit schemes. Show that Best Fit wins over the other two in this case. Or, Q5B. In a Paged virtual memory system, a CPU instruction is 16 bits long, and the page size is 512 Bytes. (a) What is the frame size? (b) How many entries are in a process page table, and (c) if each page table entry requires 32 bits, what would be the volume of the largest page table for the system? Ans. (a) Frame size = 512 Bytes. (b) Since the d = 9 (as 29 = 512), p must be 7 bits long. This implies the maximum number of pages a process can get is 27 = 128 pages. Therefore, the maximum number of entries in a process page table must be 128. (c) Since each entry consumes 32 bits = 4 Bytes, the maximum size of the largest page table would be 512 Bytes, and this would requitre exactly one frame in the memory.