This is Chapter wise solution of Operating System Concepts by Peter B. Galvin. Today we are giving here first chapter and will provide next chapters soon. This solution of Operating System Concepts by Peter B. Galvin is for students only, to understand the questions easily. Just Click on the question below and you will get answer:
Question 1.1: What are the three main purposes of an operating system?
Question 1.8: Which of the following instructions should be privileged?
Question 1.12: Is the Internet a LAN or a WAN?
Operating System Concepts by Peter B. Galvin, Exercise Solution
Question 1.1: What are the three main purposes of an operating system?
Or
Write down three main purposes of an operating system.
Solution: In a computer system there have various important purposes of an operating system; the three main purposes are as follows;
- An operating system is used to provide an environment for a computer user to execute computer programs or binary code on computer hardware in a convenient and efficient manner.
- An operating system is used as a resource manager which means it used to allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible.
- An operating system is used as a control program it serves two major functions:
- To provide the supervision of the execution of user programs to prevent errors and improper use of the computer, and
- To provide management of the operation and control of I/O devices.
Question 1.2: What are the main differences between operating systems for mainframe computers and personal computers?
Solution: Generally operating systems for mainframe computer or batch systems have simpler requirements than for personal computers but at some points there have some difference are as follows;
- Batch systems do not have to be concerned with interacting with a user as much as a personal computer.
- An operating system for a personal computer must be concerned with response time for an interactive user while batch systems do not have such requirements.
- A pure batch system also may have not to handle time sharing, whereas an operating system must switch rapidly between different jobs or tasks.
Question 1.3: List the four steps that are necessary to run a program on a completely dedicated machine.
Or
Which four steps are necessary to run a program on a completely dedicated machine?
Solution: The four steps that is highly required to run a program on a completely dedicated machine.
Step 1: Reserve machine time.
Step 2: Manually load program into memory.
Step 3: Load starting address and begin execution.
Step 4: Monitor and control execution of program from console.
Question 1.4: 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?
Solution: Single-user systems should maximize use of the system for the user. A GUI might “waste” CPU cycles, but it optimizes the user’s interaction with the system, so for at this point of the operating system to forsake the principle of an operating system to make efficient use of the computing hardware makes the system not really wasteful.
Question 1.5: What is the main difficulty that a programmer must overcome in writing an operating system for a real-time environment?
Solution: The main difficulty which is keeping by the operating system within the bounded time constraints of a real-time system that a programmer must overcomes is that, “If the system does not complete a task in a certain time frame (like bounded time constraint), it may cause a breakdown of the entire system it is running. Therefore when writing an operating system for a real-time system, the writer must be sure that his scheduling schemes don’t allow response time to exceed the time constraint”.
Question 1.6: Consider the various definitions of operating system. Consider whether the operating system should include applications such as Web browsers and mail programs. Argue both that it should and that it should not, and support your answer.
Solution:
The operating system should include applications such as Web browsers and mail programs have some advantages and disadvantages are as follows;
Points that are supports that operating system should include application (Like Web browsers and Mail programs):
- Additional functional applications such as web browsers and email (mailing programs) tools are performing an increasingly important role in modern desktop computer systems. To fulfill this role, they should be incorporated as part of the operating system.
- By doing so, these additional functionality can provide better performance and better integration with the rest of the system.
- In addition, these important applications can have the same look-and-feel as the operating system software that supports the user friendly environment with the operating system.
Counterpoint that are not supports that operating system should include application (Like Web browsers and Mail programs):
- Extra burden on Operating System: The fundamental role of the operating system is to manage system resources such as the CPU, memory, I/O devices, etc. In addition, its role is to run software applications such as web browsers and email applications. By incorporating such applications into the operating system, we burden the operating system with additional functionality. Such a burden may result in the operating system performing a less-than sat is factory job at managing system resources.
- Operating System Size Enhanced: By adding the additional functionality in Operating System we increase the size of the operating system thereby increasing the likelihood of system crashes and security violations.
Question 1.7: How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system?
Solution: The distinction between kernel mode and user mode provides a rudimentary form of protection in the following manner.
- Certain instructions could be executed only when the CPU is in kernel mode not in user mode.
- Hardware devices could be accessed only when the program is executing in kernel mode very less capability to access hardware devices in user mode.
- Control over when interrupts could be enabled or disabled is also possible only when the CPU is in kernel mode.
Consequently, the CPU has very limited capability when executing in user mode while large scaled and high capability in the kernel mode, thereby enforcing protection of critical resources in user mode of operating system.
Question 1.8: Which of the following instructions should be privileged?
- Set value of timer.
b. Read the clock.
c. Clear memory.
d. Issue a trap instruction.
e. Turn off interrupts.
f. Modify entries in device-status table.
g. Switch from user to kernel mode.
h. Access I/O device.
Solution:
Some of the instructions of a computer system are restricted to the Operating System known as privileged instructions. From the above list of operations the privileged instructions are as follows:
- Set value of timer,
- Clear memory,
- Turn off interrupts,
- Modify entries in device-status table,
- Access I/O device.
Although a computer system has only two mode i.e. kernel mode (Privileged instructions) and user mode, so the rest instructions can be performed in user mode;
- Read the clock.
- Issue a trap instruction.
- Modify entries in device-status table.
- Switch from user to kernel mode.
Question 1.9: 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.
Solution:
In some early computer systems protection is done by placing the operating system in a memory portion due to that the major problems can arrives are as follows;
- Unauthorized User Access: The data required by the operating system (passwords, access controls, accounting information, and so on) would have to be stored in or passed through unprotected memory and thus be accessible to unauthorized users.
- Default updating the Operating system: If the partition was some form of read-only memory, then updating components of the OS would be more difficult.
Question 1.10: Some CPUs provide for more than two modes of operation. What are two possible uses of these multiple modes?
Solution: Although most computer systems only distinguish between user and kernel modes, some CPUs have supported multiple modes of operations. The possible uses of these multi mode CPUs systems are as follows;
- Fine Gained Security: Multiple modes of CPUs could be used to provide a finer-grained security policy. For example, rather than distinguishing between just user and kernel mode, you could distinguish between different types of user mode. Perhaps users belonging to the same group could execute each other’s code. The machine would go into a specified mode when one of these users was running code. When the machine was in this mode, a member of the group could run code belonging to anyone else in the group.
- Distinctions of kernel code: Another possible use of multi mode CPUs would be to provide different distinctions within kernel code. For example, a specific mode could allow USB device drivers to run. This would mean that USB devices could be serviced without having to switch to kernel mode, thereby essentially allowing USB device drivers to run in a quasi-user/kernel mode.
Question 1.11: Timers could be used to compute the current time. Provide a short description of how this could be accomplished.
Solution: Timer is a program that could be used for to compute the current time of a computer system to compute this task the current time using timer interrupts. The program could set a timer for some time in the future and go to sleep. When it is awakened by the interrupt, it could update its local state, which it is using to keep track of the number of interrupts it has received thus far. It could then repeat this process of continually setting timer interrupts and updating its local state when the interrupts are actually raised.
Question 1.12: Is the Internet a LAN or a WAN?
Solution: The Internet is a WAN (Wide Area Network) technology as the various computers are located at geographically different places and are connected by long-distance network links.