xv6 book Chapter 2 Operating system organization

  • A key requirement for an operating system is to support several activities at once.
  • Thus an operating system must fulfill three requirements:
  1. multiplexing
  2. isolation
  3. interaction

Abstracting physical resources

  • It’s more typical for application to not trust each other, and to have bugs, so one often wants stronger isolation than a cooperative scheme provides.
  • To achieve strong isolation it’s helpful to forbid applications from directly accessing sensitive hardware resources, and instead to abstract the resources into services.
  • Similarly, Unix transparently switched hardware CPUs among processes, saving and restoring register state as necessary, so that applications don’t have to be aware of time sharing.
  • Strong isolation requires a hard boundary between applications and the operating system.
  • To achieve strong isolation, the operating system must arrange that applications cannot modify the operating system’s data structures and instructions and that applications cannot access other processes’ memory.

Kernel organization

  • A key design question is what part of the operating system should run in supervisor mode.

monolithic kernel

  1. OS runs in kernel space
  2. kernel interface == system call interface

good

  1. it is easier for different parts of the operating system to cooperate
  2. one cache shared by file system and virtual memory

bad:

  1. interfaces between different parts of the operating system are often complex
  2. it’s easy for operating system developer to make a mistake
  3. no isolation within

microkernel

  1. many OS services run as ordinary user programs
  2. kernel implements minimal mechanism to run services in user space
  3. kernel interface != system call interface

good

  1. more isolation

bad

  1. may be to hard to get good performance

猜你喜欢

转载自blog.csdn.net/weixin_41714373/article/details/109756549