You are on page 1of 2

1. What are the main functions of OS?

The main functions of an OS include: To manage the sharing of internal memory among multiple applications. To handle and monitor input and output to and from attached hardware devices, such as hard disks, printers, and dial-up ports. To send messages to each application or interactive user (or to a system operator) about the status of operation and any errors that may have occurred. It can offload the management of what are called batch jobs (for example, printing) so that the initiating application is freed from this work. On parallel processing, it manages how to divide the program so that it runs on more than one processor at a time. Scheduling the activities of the CPU and resources to achieve efficiency and prevention of deadlock In a multitasking system, it determines which applications should run in what order and how much time should be allowed for each application before giving another application a turn. 2. What does the CPU do when there is no application programs to run? There is always a program to run (as long as the computer is turned on). The cycle of fetching , decoding, and executing instructions never stops. When there are no user programs to run, the operating system will execute in a loop that does nothing (called a busy-wait loop or idle loop) until an interrupt occurs. 3. What characteristics is common to traps, interrupts, supervisor call and subroutine calls? Traps, interrupts, supervisor calls and the subroutine calls all save the current value of the program counter and branch to a new location in memory. 4. Why must a computer start in kernel mode when power is first turned on? When power is first turned on, the contents of memory is undefined. The boot program in ROM must read the code from the boot device to load into memory. To perform the input operation, the hardware must be in kernel mode. Since, the operating system is not loaded, there are no supervisor calls the ROM boot program could use if it was in user mode. 5. Classify the following application as batch or interactive; a. Generating personal tax returns Interactive b. Generating employee tax forms Batch c. A flight simulator Interactive

6. On a system with n CPUs, what is the maximum number of processes that can be in the ready, run, and blocked state? There is no limit to the number of processes that can be in the ready and blocked states. At most, n processes may be in the run state, since a process in the run state must be allocated to a CPU, and there are only n CPUs. 7. On a system with n CPUs, what is the minimum number of processes that can be in the ready, run, and blocked state? There can be Zero processes in any of the three states. It is possible for all the processes to be blocked while waiting on I/O operations, leaving no processes in the ready and running states. All processes can be either in the ready or run state, leaving no processes blocked. 8. What is the principle advantage of multiprogramming? It increases CPU utilization. While one process is blocked, waiting for I/O to complete, the CPU may execute another process. 9. For each of the following transitions between processes states, indicate whether the transition is possible. If it is possible, give an example of one thing that would cause it. a. RunReady Possible, when a processes time quantum expires. b. RunBlocked Possible, when a process issues an I/O request. c. Blocked Run Not possible, although process could first go to the ready state, then to the run state. d. RunTerminated Possible, when a process terminates itself. 10. Given a system with n processes, how many possible ways can those processes be scheduled? This is a combinatorics problem of how many ways n objects can be ordered. When selecting the first object, one has n possible choices. For the second object, n-1. Each subsequent selection involves one less choice. The total number of possibilities is computed by multiplying all the possibilities at each point, making the answer n!. 11. On a system using round-robin scheduling, what would be the effect of including one process twice in the list of processes? In round robin, all ready processes are given equal access to the CPU. CPU time is divided equally among the processes. If a process was listed twice, it would be granted twice the CPU time of the other processes.

You might also like