Skip to content

Latest commit

 

History

History
268 lines (154 loc) · 16.9 KB

Chapter1.md

File metadata and controls

268 lines (154 loc) · 16.9 KB

Chapter 1 Review Questions

Operating Systems

1.1. - 1.17


Q 1.1. What are the main purposes of an operating system?

  • Answer:

    1. Resource Allocation
    2. Supervision
    3. Managing I/O Devices

Q 1.2. We have stressed the need for an operating system to make efficient use of the computing hardware. When it is appropiate for the operating system to forsake this principle and to "waste resources"? Why is such a system not really wasteful?

  • Answer:

  • ** Part 1: **

    • It may be appropiate for operating systems to forsake the principle to make efficient use of the computer hardware and waste resources in case of single-user systems. In such systems, the use of computer resources must be maximized for the user.
  • ** Part 2: **

    • Such a system is not really wasteful because although a graphical user interface may waste CPU cycles, but by maximizing the use of the system, it optimizes the user's interaction with the system.

Q 1.3. What is the main difficulty that a programmer must overcome in writing an operating system for a real-time environment?

  • Answer: The main difficulty is keeping the operating system within the fixed time constraints of a real-time system.

Q 1.4. Keeping in mind 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 it should not, and support your answers.

  • Answer:
    • **Part 1: **

      • As per computer architecture, the computer system is categorised into four major components: application programs, operating system, hardware, and user. The mail program and web browser belongs to application program, not to operating system.

      • Operating system is defined as the program, which is running all the time on the computer system. But the mail programs and the web browsers do not run all the time on the system. Hence they cannot be regarded as operating systems.

    • **Part 2: **

      • Operating System is defined as the program which acts as the interface between the hardware and the computer user, controlling and allocating the resources, thus they are part of the operating system.

      • Also, the operating systems generally include all those applications which are provided by vendors. As many vendors provide mail programs and web browsers along with operating systems, they are also included in operating systems.

**Q 1.5. ** How does the distinction between kernel module and user mode function as a rudimentary form of protection (security) system?

  • Answer:
    • **Kernel Mode: **

    • It is mandatory that certain instructions must be executed only when the operating system is in kernel mode.

    • Access to hardware Devices can be done only when the program is executing in kernel mode.

    • Interrupts can be controlled only when the CPU is executing in kernel mode.

    • The privileged instructions can be executed only when the CPU is in kernel mode.

    • **User Mode: **

    • When the CPU is executing in user mode, its capacity is limited.

    • Executing privileged instructions in user mode will cause a trap to the operating system. Thus, dual mode of operation provides a rudimentary form of protection.

** Q 1.6. ** Which of the following instructions should be privileged?

  • Answer:

    a. Set value of timer (Kernel Mode)

    b. Read the clock. (User Mode)

    c. Clear memory. (Kernel Mode)

    d. Issue a trap instruction. (User Mode)

    e. Turn off interrupts. (Kernel Mode)

    f. Modify entries in device-status table (Kernel Mode)

    g. Switch from User to Kernel Mode (User Mode)

    h. Access I/O device (Kernel Mode)

** Q 1.7. ** Some early computers protected the operating system by placing a memory partition that could not be modified by either the user job or operating system itself. Describe two difficulties that you think could arise with such a scheme.

  • Answer: By placing the operating system in a memory partition that could not be modified by either the user job or the operating system itself, the difficulties are listed below:

    1. The critical data such as passwords and access control information that are required by or generated by the operating system would have to be passed through or stored in unprotected memory slots and would be accessible to unauthotized users.

    2. The operating system could never be updated or patched, since it is not modifiable or accessible by the user or the operating system itself.

** Q 1.8. ** Some CPUs provide for more than two modes of operation. What are two possible uses of these multiple modes?

  • Answer:

    • Part 1:

      1. Kernel Mode
      2. User Mode
    • Part 2:

      • Some CPU's have supported **multiple modes** of operation by providing different distinctions in kernel mode and user mode separately, rather than distinguishing between just kernel and user mode.
    • Part 3:

      1. One possibility would be to provide different distinctions within kernel code. For example, a specific code would allow USB devices could allow USB devices to driver to run. This would mean that that USB devices could be serviced without having to switch to kernel mode, there by essentially allowing USB device drivers to run in a quasi-user/kernel mode.

      2. Second possibility would be to provide different distinctions within user mode. Multiple user modes could be used to provide a finer-grained security policy. Perhaps users belonging to the same group could execute each others code. When the machine was in this mode, a member of the group could run belonging to anyone else in the group.

** Q 1.9. ** Timers could be used to compute the current time. Provide a short description of how this could be accomplished.

  • Answer: Timers can take the help of a program that uses the following steps to calculate current time with the help of timer interrupts:

    1. Sets the timer for some time later than the current time and goes to sleep.

    2. An interrupt wakes up the program; that is when it updates its local state, which it uses to keep a record of the number of interrupts it has received by far.

    3. Then it repeats this process of establishing timer interrupts and updating its local state when these timer interrupts are raised.

** Q 1.10. ** Give two reasons why caches are useful. What problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?

  • **Part 1: **

  • If the active portions of program and data are placed in a fast small memory, the average memory access time can be reduced, thus reducing the total execution time of the program. Such a fast small memory is referred as cache memory.

  • **Part 2: **

    • Caches are useful when two or more components need to exchange data, and the components perform transfer at different speeds. Caches solve the transfer problem by providing a buffer of intermediate speed between the components. If the fast device finds the data it needs in the cache, it need not wait for the slower device. The data in the cache must be kept consistent with the data in the components. If a component has a data value change, and the datum is also in the cache, the cache must also be updated.
  • **Part 3: **

    • This is especially a problem on multiprocessor systems where more than once process may be accessing a datum. A component may be eliminated by an equal-sized cache, but only if: a) the cache and the component have equivalent state-saving capacity (that is, the component retains its data when electricity is removed, the cache must retain data as well), and b) the cache is affordable, because faster storage tends to be more expensive.

**Q 1.11. ** Distinguish between the client–server and peer-to-peer models of distributed systems.

  • Answer:
Client-Server Model Peer-To-Peer Model
In this model, systems are categorized as client systems. In this model, all nodes are considered peers.
Client systems request for services from server systems. Server systems satisfy request of the client systems. Each peer can act as client or server depending on the operation it is performing.
Resources are controlled and available at the server system. Resources are distributed among the peers and are easy to be shared among the peers.
Client-Server model offers greater security than peer-to-peer model as authentication of users is done at the central server Peer-To-Peer model offers less security than client-server model as there is no central server that authenticate users.
The setup of the client-server model is expensive The setup of peer-to-peer model is less expensive
Client server model is difficult to configure Peer-To-Peer model is easy to configure.
For large office setups and for organizations where there is sensitive date, client server model is suggestable. At home and for small office setups, peer-to-peer model is suggestable.

** Q 1.12. ** In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation can result in various security problems.

  • a. What are two such problems?

    • Answer:

      Memory management - the system must allocate the memory to several jobs CPU scheduling - the system must choose among several jobs ready to run.

  • b. Can we ensure the same degree of security in a time-shared machine as in a dedicated machine? Explain your answer.

    • Answer:

      We can't ensure the same degree of security in a time-shared machine as we have in a dedicated machine, because in a time-shared machine there are several jobs simultaneously in memory. Since any protection scheme devised by humans can inevitably break by a human, more complex the scheme.

    ** Q 1.13. **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

  • Answer:

    1. Memory Resources: Main Memory (RAM) is an important part of the mainframe systems that must be carefully managed, as it is shared among a large number of users.

    2. CPU Resources: Again, due to being shared amongst a lot of users it is important to manage CPU resources in mainframes and minicomputer systems.

    3. Storage: Storage is an important resource that requires to be managed due to being shared among multiple users.

    4. Network Bandwidth: Sharing of data is a major activity in systems shared by multiple users. It is important to manage network bandwidth in such systems.

b. Workstations connected to servers

  • Answer:

    1. Memory Resources: When Workstations are connected to servers, multiple applications run on multiple Workstations on a single server. This is an important factor due to which Memory management is required in Workstations connected to servers.

    2. CPU Resources: Multiple Workstations make request to access resources to accomplish the tasks assigned to them. To ensure the fair and efficient completion of tasks, it is important to manage CPU resources in workstations connected to servers.

c. Mobile computers

  • Answer:

    1. Power Consumption: Handheld Computers use compact, portable and small batteries as a source of power. It is important to manage power Consumption in such devices to be able to make their use efficient and easy.

    2. Memory Resources: Due to being small in size, the memory devices use in such computers are also small, thus deteriorating its storage capacity. This makes memory resource management and important requirement in handheld devices.

  • **Q 1.14. ** Under what circumstances would a user be better off using a timesharing system than a PC or a single-user workstation?

    • Answer:

      Time sharing system or multitasking is a logical extension of multiprogramming. In Time sharing, CPU executes multiple jobs by switching among them. When switches occur frequently, then the user can interact with each program while it is running. But multitasking and multiprogramming is not possible on single user.

      When there are few other users, the task is large, and the hardware is fast, timesharing makes sense. The full power of the system can be brought to bear on the user's problem.

      The problem can be solved faster than on a personal computer. Another case occurs when lots of other users need resources at the same time. A personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the program to the user's satisfaction.

      A time-shared Operating System uses CPU scheduling and multiprogramming to provide each user with a small portion of a time shared computer. If other users need to access the same system, then a time sharing system would work better than a PC or a single-user Workstation. If there is only a single and executive user, then a PC or single-user workstation would be better.

  • **Q 1.15. ** Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems?

    • Answer:

      Part 1:

      1. In symmetric multiprocessing (SMP)
      • All processors are peers.
      • All processors runs a copy of operating system.
      • Processors communicate with one another as needed.
      • No special hardware / software needed to differentiate as neither master nor slave exist.
      1. In asymmetric multiprocessing (ASMP)
      • Processor will have master-slave relationship scheme.
      • Each processors is assigned by a specific task. (by a master processor)
      • A master process controls the system.
      • Special hardware or software can only differentiate one master and multiple slaves.

      Part 2:

      The three advantages of multiprocessor systems are

      1. Increase Throughput * obviously more work can be done in less time. It is because of increase of number of processors (the term multiprocessor means to be)

      2. Economy Of Scale * The cost of multiprocessor systems is less when compared to equivalent multiple single-processor systems. It is because the multiple processors in multiprocessor systems share

        • Peripherals
        • Mass Storage
        • Power Supplies
      3. Increased Reliability * Failure of one processor will not halt the system, but slow it down.

      Part 3:

      1. The disadvantage of multiprocessor systems is
      • The solution of "activating a back-up copy and restarting the most recent check point" in time of system failure is much expensive, since it involves considerably hardware duplication.

Q 1.16. How do clustered systems differ from multiprocessor systems? What is required for two machine belonging to a cluster to cooperate to provide a highly available service?

  • Answer:

Part 1: Clustered systems is made up of together of multiple CPUs to accomplish computational work. Clustered systems differ from multiprocessor systems, however, in that they are composed of two or more individual systems compiled together. It shares storage and are closely lined via LAN networking.

Part 2: It provides high- availability service i.e., service will continue to be provided even if one of more systems in the cluster fails. High- availability is generally obtained by adding a level of redundancy in the system. A layer of cluster software runs on the cluster nodes. Each node can monitor one or more of the others (over LAN). If the monitored machine fails, the monitoring machine can take ownership of its storage and restart the application that were running on failed machine.

Q 1.17. Consider a computing cluster consisting of two nodes running a database. Describe two ways in which the cluster software can manage access to the data on the disk. Discuss the benefits and disadvantages of each.

  • Answer:

Part 1: Cluster systems gather together multiple CPU's to accomplish computational work. It differs from parallel system. The cluster computer share storage and are closely linked via LAN networking. Clustering provides high-availability service; i.e. service will continue to be provided even when one or more system(s) in the cluster fail. Clustering can be structured symmetrically or asymmetrically.

Part 2: The asymmetric clustering, one machine is hot-stand by mode, while the other is running the applications. The host-stand by host machines does nothing but monitor the active server. If that server fails, the hot stand by host becomes the active server.

Part 3: In symmetric mode, two or most hosts are running applications, and they are monitoring each other. This mode is different, as it uses all the available hardware. It requires more than one application be available to run.