Chapter 23 VAX/VMS Virtual Memory System
第 23 章 VAX/VMS 虚拟内存系统
这是一个操作系统??
1. 背景
We’ll do this by covering two systems.
1.1. The first is VAX/VMS
The first is one of the earliest examples of a “modern” virtual memory manager, that found in the VAX/VMS operating system [LL82], as developed in the 1970’s and early 1980’s; a surprising number of techniques and approaches from this system survive to this day, and thus it is well worth studying. Some ideas, even those that are 50 years old, are still worth knowing, a thought that is well known to those in most other fields (e.g., Physics), but has to be stated in technology-driven disciplines (e.g., Computer Science).
1.2. The second is Linux
The second is that of Linux, for reasons that should be obvious. Linux is a widely used system, and runs effectively on systems as small and underpowered as phones to the most scalable multicore systems found in modern datacenters. Thus, its VM system must be flexible enough to run successfully in all of those scenarios. We will discuss each system to illustrate how concepts brought forth in earlier chapters come together in a complete memory manager.
2. 内存管理硬件
减少页表对内存的压力
2.1. 将用户地址空间分成两部分
2.2. 在内核虚拟内存中放置用户页表
3. 一个真实的地址空间
WHY NULL POINTER ACCESSES CAUSE SEG FAULTS
为什么空指针访问会导致段错误?
You should now have a good understanding of exactly what happens on a null-pointer dereference. A process generates a virtual address of 0, by doing something like this:
int *p = NULL; // set p = 0
*p = 10; // try to store 10 to virtual addr 0
The hardware tries to look up the VPN (also 0 here) in the TLB, and suffers a TLB miss. The page table is consulted, and the entry for VPN 0 is found to be marked invalid. Thus, we have an invalid access, which transfers control to the OS, which likely terminates the process (on UNIX systems, processes are sent a signal which allows them to react to such a fault; if uncaught, however, the process is killed).
4. 页替换
4.1. 分段的 FIFO
segmented FIFO
还是应用了脏页的 FIFO...
4.2. 页聚集
clustering
将大批量的页从全局脏列表中分组到一起,并将他们一举写入disk...让他们变脏...
5. 其他漂亮的虚拟内存技巧
惰性优化...
惰性
TIP: BE LAZY
Being lazy can be a virtue in both life as well as in operating systems. Laziness can put off work until later, which is beneficial within an OS for a number of reasons.
First, putting off work might reduce the latency of the current operation, thus improving responsiveness; for example, operating systems often report that writes to a file succeeded immediately, and only write them to disk later in the background.
Second, and more importantly, laziness sometimes obviates the need to do the work at all; for example, delaying a write until the file is deleted removes the need to do the write at all.
Laziness is also good in life: for example, by putting off your OS project, you may find that the project specification bugs are worked out by your fellow classmates; however, the class project is unlikely to get canceled, so being too lazy may be problematic, leading to a late project, bad grade, and a sad professor. Don’t make professors sad!
Last updated