1) What are the three main purposes of an operating
system? 2) We have stressed the need for an operating system to make efficient use of the computing hardware. When is it appropriate for the operating system to forsake this principle and to “waste” resources? Why is such a system not really wasteful? 3) What is the main difficulty that a programmer must overcome in writing an operating system for a real-time environment? 4) How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system? 5) Some early computers protected the operating system by placing it in a memory partition that could not be modified by either the user job or the operating system itself. Describe two difficulties that you think could arise with such a scheme. 6) Timers could be used to compute the current time. Provide a short description of how this could be accomplished. 7) The issue of resource utilization shows up in different forms in different types of operating systems. List what resources must be managed carefully in the following settings: a. Mainframe or minicomputer systems b. Workstations connected to servers c. Mobile computers 8) What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user program? If so, for what purpose? 9) Describe a mechanism for enforcing memory protection in order to prevent a program from modifying the memory associated with other programs. 10) Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU’s execution load. a. How does the CPU interface with the device to coordinate the transfer? b. How does the CPU know when the memory operations are complete? c. The CPU is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere with the execution of the user programs? If so, describe what forms of interference are caused. 11) What is the purpose of system calls? 12) What system calls have to be executed by a command interpreter or shell in order to start a new process? 13) What is the main advantage of the layered approach to system design? What are the disadvantages of the layered approach? 14) Why do some systems store the operating system in firmware, while others store it on disk? 15) How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need to do? 16) Describe three general methods for passing parameters to the operating system 17) What are the two models of interprocess communication? What are the strengths and weaknesses of the two approaches? 18) What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach? 19) Describe the differences among short-term, medium- term, and long term scheduling. 20) Describe the actions taken by a kernel to context- switch between processes. 21) A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many different schedules are possible? Give a formula in terms of n. 22) Explain the difference between preemptive and nonpreemptive scheduling. 23) Suppose that the following processes arrive for execution at the times indicated. Each process will run for the amount of time listed. In answering the questions, use nonpreemptive scheduling, and base all decisions on the information you have at the time the decision must be made. Process Arrival Time Burst Time P1 0.0 8 P2 0.4 4 P3 1.0 1 a. What is the average turnaround time for these processes with the FCFS scheduling algorithm? b. What is the average turnaround time for these processes with the SJF scheduling algorithm? c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be called future- knowledge scheduling. 24) Discuss how the following pairs of scheduling criteria conflict in certain settings. a. CPU utilization and response time b. Average turnaround time and maximum waiting time c. I/O device utilization and CPU utilization 25) Consider the following set of processes, with the length of the CPU burst given in milliseconds
The processes are assumed to have arrived in the order P1,
P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2). b. What is the turnaround time of each process for each of the scheduling algorithms in part a? c. What is the waiting time of each process for each of these schedul ing algorithms? d. Which of the algorithms results in the minimum average waiting time (over all processes)? 26) The following processes are being scheduled using a preemptive, round robin scheduling algorithm. Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. In addition to the processes listed below, the system also has an idle Exercises 309 task (which consumes no CPU resources and is identified as Pidle). This task has priority 0 and is scheduled whenever the system has no other available processes to run. The length of a time quantum is 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue. a. Show the scheduling order of the processes using a Gantt chart. b. What is the turnaround time for each process? c. What is the waiting time for each process? d. What is the CPU utilization rate?
27) Which of the following scheduling algorithms could
result in starvation? a. First-come, first-served b. Shortest job first c. Round robin d. Priority