Operating System Concepts--Chapter 1 Exercises

1.1 What are the three main purposes of an operating system?

  • ease of use in user view
  • a resource allocator in system view
  • control the various I/O devices and user programs

1.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?

the operating system of PC or mobile devices such as smartphones and tablets is designed mostly for ease of use, with some attention paid to performance and security and none paid to resource utilization—how various hardware and software resources are shared.

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

A real-time system has well-defined, fixed time constraints. Processing must be done within the defined constraints, or the system will fail

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 that it should not, and support your answers.

NO.

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

A bit, called the mode bit, is added to the hardware of the computer to indicate the current mode: kernel (0) or user (1). With the mode bit, we can distinguish between a task that is executed on behalf of the operating system and one that is executed on behalf of the user. When the computer system is executing on behalf of a user application, the system is in user mode.However, when a user application requests a service from the operating system (via a system call), the system must transition from user to kernel mode to fulfill the request.
在这里插入图片描述

1.6 Which of the following instructions should be privileged?

a. 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.

ALL 不知道对不对。。。上面这些操作都应该经过操作系统内核来操作。
The instruction to switch to kernel mode is an example of a privileged instruction. Some other examples include I/O control, timer management, and interrupt management.

1.7 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.

  • 操作麻烦
  • 断电丢失

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

CPUs that support virtualization (Section 18.1) frequently
have a separate mode to indicate when the virtual machine manager (VMM) is in control of the system

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

A timer can be set to interrupt the computer after a specified period. The period may be fixed (for example, 1/60 second) or variable (for example, from 1 millisecond to 1 second). A variable timer is generally implemented by a fixed-rate clock and a counter. The operating system sets the counter. Every time the clock ticks, the counter is decremented. When the counter reaches 0, an interrupt occurs. For instance, a 10-bit counter with a 1-millisecond clock allows interrupts at intervals from 1 millisecond to 1,024 milliseconds, in steps of 1 millisecond.

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?

  • two reasons:
    高速访问,寄存器-缓存-内存-磁盘,访问效率逐步降低,使用缓存可以提高CPU的利用率(多线程比较明显)。
    命中率,高级别的缓存是低级别缓存的备份,如果指令/数据在高级别的缓存中已经存在则直接使用提高指令/数据的读取效率。
  • problems:
    in a multitasking environment or in a multiprocessor environment or in a distributed environment
    数据同步
    数据持久化
  • why:
    贵,存取越快的同等容量缓存越贵。
    数据存储在高速缓存(寄存器,cache)包括内存在断电后都会丢失的。
    太大了也没用,CPU用不上还是浪费,这个说到底还是贵,不划算。

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

  • distinguish
    client-server(CS):客户端使用服务端提供的服务接口请求访问服务端提供服务。服务端响应客户端的请求做服务操作后放回结果给客户端。
    peer-to-peer(P2P):可以认为是升级版,相互之间都可以作为服务端和客户端,可以相互请求、相互服务、相互响应。

1.12 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?

  • how differ
    多处理器系统还是一台计算机,集群系统需要2台以上设备了。
    集群系统需要考虑CAP理论。
  • what
    A layer of cluster software runs on the cluster nodes. Each node can monitor one or more of the others (over the network). If themonitoredmachine fails, the monitoring machine can take ownership of its storage and restart the applications that were running on the failed machine.

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

1.14 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?
1.15 Explain how the Linux kernel variables HZ and jiffies can be used to
determine the number of seconds the system has been running since it
was booted.
1.16 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.
EX-1
1.17 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.
1.18 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?
1.19 Rank the following storage systems from slowest to fastest:
a. Hard-disk drives
b. Registers
c. Optical disk
d. Main memory
e. Nonvolatile memory
f. Magnetic tapes
g. Cache

1.20 Consider an SMP system similar to the one shown in Figure 1.8. Illustrate
with an example how data residing in memory could in fact have a
different value in each of the local caches.
1.21 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
1.22 Describe a mechanism for enforcing memory protection in order to
prevent a program from modifying the memory associated with other
programs.
1.23 Which network configuration—LAN or WAN—would best suit the following
environments?
a. Acampus student union
b. Several campus locations across a statewide university system
c. Aneighborhood
1.24 Describe some of the challenges of designing operating systems for
mobile devices compared with designing operating systems for traditional
PCs.
1.25 What are some advantages of peer-to-peer systems over client–server
systems?
1.26 Describe some distributed applications that would be appropriate for a
peer-to-peer system.
EX-2
1.27 Identify several advantages and several disadvantages of open-source
operating systems. Identify the types of people who

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值