Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapter1.md #82

Open
wants to merge 1 commit into
base: rev8
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/chapter1.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Xv6抛在Intel 80386 或者后来的(“x86”)处理器平台上, 多数

这种方法的缺点是应用的程序可以随意调用库,这意味着应用程序也可以不用库。如果应用程序不使用操作系统库,那么操作系统不能实现分时复用。操作系统必须依靠应用程序表现正确,比如周期性放弃处理器控制权以便其他的应用程序可以运行。这种`cooperative`分时复用策略可能对所有应用程序互相信任彼此的系统有效,但是对于应用程序彼此不信任的系统则不能提供强有力的隔离。

为了达到强效的隔离,一种行之有效的方法是不允许应用程序直接访问硬件资源,取而代之的是把硬件资源抽象成服务。比如,应用程序同文件系统的交互仅仅通过`open`,`read`,`write`,`close`系统调用而不是直接读写磁盘扇区。这种方法给应用程序带来方便,只需要使用路径名,同时也允许操作系统(作为借口的实现方)管理磁盘。
为了达到强效的隔离,一种行之有效的方法是不允许应用程序直接访问硬件资源,取而代之的是把硬件资源抽象成服务。比如,应用程序同文件系统的交互仅仅通过`open`,`read`,`write`,`close`系统调用而不是直接读写磁盘扇区。这种方法给应用程序带来方便,只需要使用路径名,同时也允许操作系统(作为接口的实现方)管理磁盘。

相似地,使用`fork`产生应用程序进程的方法,允许操作系统在进程切换时代替应用程序保存和恢复寄存器,对应用程序隐藏进程切换的过程。而且,如果应用程序是一个无限循环,操作系统能够强行将应用程序换出处理器。

Expand Down