跳转至

操作系统第二章 作业

2.2

List five services provided by an operating system that are designed to make it more convenient for users to use the computer system. In what cases it would be impossible for user-level programs to provide these services? Explain.

1 程序执行 服务:操作系统将程序装载入内存并执行程序。 若使用用户程序提供该服务,则很有可能带来安全隐患,因为应用程序可能会装载非法程序。

2 I/O 操作 服务:系统提供方便操作 I/O 设备的方法。 若使用用户程序提供该服务,在多用户系统中,应用程序可能会窃取其它用户存储在硬盘里的数据。

3 文件系统操作 服务:提供文件的,创建、删除、搜索、获取信息方法,并提供访问权限管理。 同样,应用程序可能会非法访问文件。

4 通信 服务:提供进程间的相互通信。(同一计算机内的不同进程或通过网络链接的不同计算机的进程) 同样,应用程序可能会非法窃听其它应用的信息。

5 错误检测 服务:对于发生在硬件上或用户程序中的错误,操作系统采取适当的处理措施。 若使用应用程序提供该服务,则应用程序在编写时需要考虑所有可能的错误,这是不现实的。

2.5

What are the five major activities of an operating system in regard to file management?

  • 文件的创建和删除
  • 文件的打开和关闭
  • 文件的读、写、重定位
  • 读取文件属性和设置文件属性
  • 文件的权限管理

2.8

What are the two models of interprocess communication? What are the strengths and weaknesses of the two approaches?

1 共享内存 (shared-memory model) 优点:

  • 速度快
  • 访问数据方便

缺点:

  • 不易进行数据的保护和同步

2 消息 (message-passing model) 优点:

  • 不必避免冲突
  • 计算机间通信时,更容易实现

缺点:

  • 大量数据传输时,速度慢