Docsity

Operating System Concepts Chapter 1 Exercise Solution Part 2, Exercises of Operating Systems

Toggle sidebar
bg1
1
CHAPTER
Introduction
Chapter 1 introduces the general topic of operating systems and a handful of
important concepts (multiprogramming, time sharing, distributed system, and
so on). The purpose is to show why operating systems are what they are by
showing how they developed. In operating systems, as in much of computer
science,weareledtothepresentbythepathswetookinthepast,andwecan
better understand both the present and the future by understanding the past.
Additional work that might be consideredislearningabouttheparticular
systems that the students will have access to at your institution. This is still just
a general overview, as specific interfaces are considered in Chapter 3.
Exercises
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?
b. Can we ensure the same degree of security in a time-shared
machine as in a dedicated machine? Explain your answer.
Answer:
a. Stealing or copying one’s programs or data; using system resources
(CPU, memory, disk space, peripherals) without proper accounting.
b. Probably not, since any protection scheme devised by humans
can inevitably be broken by a human, and the more complex
the scheme, the more difficult it is to feel confident of its correct
implementation.
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
1
pf3
pf4
pf5

Partial preview of the text

Download Operating System Concepts Chapter 1 Exercise Solution Part 2 and more Exercises Operating Systems in PDF only on Docsity!

C H A P T E R

Introduction

Chapter 1 introduces the general topic of operating systems and a handful of important concepts (multiprogramming, time sharing, distributed system, and so on). The purpose is to show why operating systems are what they are by showing how they developed. In operating systems, as in much of computer science, we are led to the present by the paths we took in the past, and we can better understand both the present and the future by understanding the past. Additional work that might be considered is learning about the particular systems that the students will have access to at your institution. This is still just a general overview, as specific interfaces are considered in Chapter 3.

Exercises

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? b. Can we ensure the same degree of security in a time-shared machine as in a dedicated machine? Explain your answer.

Answer:

a. Stealing or copying one’s programs or data; using system resources (CPU, memory, disk space, peripherals) without proper accounting. b. Probably not, since any protection scheme devised by humans can inevitably be broken by a human, and the more complex the scheme, the more difficult it is to feel confident of its correct implementation.

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

1

2 Chapter 1 Introduction

b. Workstations connected to servers c. Mobile computers

Answer:

a. Mainframes: memory and CPU resources, storage, network band- width b. Workstations: memory and CPU resources c. Mobile computers: power consumption, memory resources

1.14 Under what circumstances would a user be better off using a time- sharing system rather than a PC or a single-user workstation? Answer: When there are few other users, the task is large, and the hardware is fast, time-sharing 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. 1.15 Describe the differences between symmetric and asymmetric multipro- cessing. What are three advantages and one disadvantage of multipro- cessor systems? Answer: Symmetric multiprocessing treats all processors as equals, and I/O can be processed on any CPU. Asymmetric multiprocessing has one master CPU and the remainder CPUs are slaves. The master distributes tasks among the slaves, and I/O is usually done by the master only. Multiprocessors can save money by not duplicating power supplies, housings, and peripherals. They can execute programs more quickly and can have increased reliability. They are also more complex in both hardware and software than uniprocessor systems. 1.16 How do clustered systems differ from multiprocessor systems? What is required for two machines belonging to a cluster to cooperate to provide a highly available service? Answer: Clustered systems are typically constructed by combining multiple com- puters into a single system to perform a computational task distributed across the cluster. Multiprocessor systems on the other hand could be a single physical entity comprising of multiple CPUs. A clustered system is less tightly coupled than a multiprocessor system. Clustered systems communicate using messages, while processors in a multiprocessor system could communicate using shared memory. In order for two machines to provide a highly available service, the state on the two machines should be replicated and should be consistently updated. When one of the machines fails, the other could then takeover the functionality of the failed machine.

4 Chapter 1 Introduction

Answer: The CPU can initiate a DMA operation by writing values into special registers that can be independently accessed by the device. The device initiates the corresponding operation once it receives a command from the CPU. When the device is finished with its operation, it interrupts the CPU to indicate the completion of the operation. Both the device and the CPU can be accessing memory simultaneously. The memory controller provides access to the memory bus in a fair manner to these two entities. A CPU might therefore be unable to issue memory operations at peak speeds since it has to compete with the device in order to obtain access to the memory bus. 1.21 Some computer systems do not provide a privileged mode of operation in hardware. Is it possible to construct a secure operating system for these computer systems? Give arguments both that it is and that it is not possible. Answer: An operating system for a machine of this type would need to remain in control (or monitor mode) at all times. This could be accomplished by two methods:

a. Software interpretation of all user programs (like some BASIC , Java, and LISP systems, for example). The software interpreter would provide, in software, what the hardware does not provide. b. Require that all programs be written in high-level languages so that all object code is compiler-produced. The compiler would generate (either in-line or by function calls) the protection checks that the hardware is missing. 1.22 Many SMP systems have different levels of caches; one level is local to each processing core, and another level is shared among all processing cores. Why are caching systems designed this way? Answer: The different levels are based on access speed as as well as size. In general, the closer the cache is to the CPU, the faster the access. However, faster caches are typically more costly. Therefore, smaller and faster caches are placed local to each CPU, and shared caches that are larger, yet slower, are shared among several different processors. 1.23 Consider an SMP system similar to the one shown in Figure 1.6. Illustrate with an example how data residing in memory could in fact have a different value in each of the local caches. Answer: Say processor 1 reads data A with value 5 from main memory into its local cache. Similarly, processor 2 reads data A into its local cache as well. Processor 1 then updates A to 10. However, since A resides in processor 1’s local cache, the update only occurs there and not in the local cache for processor 2.

Exercises 5

1.24 Discuss, with examples, how the problem of maintaining coherence of cached data manifests itself in the following processing environments:

a. Single-processor systems b. Multiprocessor systems c. Distributed systems

Answer: In single-processor systems, the memory needs to be updated when a processor issues updates to cached values. These updates can be performed immediately or in a lazy manner. In a multiprocessor system, different processors might be caching the same memory location in its local caches. When updates are made, the other cached locations need to be invalidated or updated. In distributed systems, consistency of cached memory values is not an issue. However, consistency problems might arise when a client caches file data.

1.25 Describe a mechanism for enforcing memory protection in order to prevent a program from modifying the memory associated with other programs. Answer: The processor could keep track of what locations are associated with each process and limit access to locations that are outside of a program’s extent. Information regarding the extent of a program’s memory could be maintained by using base and limits registers and by performing a check for every memory access.

1.26 Which network configuration— LAN or WAN —would best suit the following environments?

a. A campus student union b. Several campus locations across a statewide university system c. A neighborhood

Answer:

a. LAN b. WAN c. LAN or WAN

1.27 Describe some of the challenges of designing operating systems for mobile devices compared with designing operating systems for tradi- tional PC s. Answer: The greatest challenges in designing mobile operating systems include:

  • Less storage capacity means the operating system must manage memory carefully.
  • The operating system must also manage power consumption care- fully.