COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

With the use of paging, truly effective multiprogramming
systems came into being. Furthermore, the simple tactic of breaking a process up
into pages led to the development of another important concept: virtual memory.

To understand virtual memory, we must add a refinement to the paging
scheme just discussed. That refinement is demand paging, which simply means that
each page of a process is brought in only when it is needed, that is, on demand.

Consider a large process, consisting of a long program plus a number of arrays
of data. Over any short period of time, execution may be confined to a small sec-
tion of the program (e.g., a subroutine), and perhaps only one or two arrays of data
are being used. This is the principle of locality, which we introduced in Appendix
4A. It would clearly be wasteful to load in dozens of pages for that process when
only a few pages will be used before the program is suspended. We can make bet-
ter use of memory by loading in just a few pages. Then, if the program branches
to an instruction on a page not in main memory, or if the program references data
on a page not in memory, a page fault is triggered. This tells the OS to bring in the
desired page.

Thus, at any one time, only a few pages of any given process are in memory,
and therefore more processes can be maintained in memory. Furthermore, time is
saved because unused pages are not swapped in and out of memory. However, the
OS must be clever about how it manages this scheme. When it brings one page in, it
must throw another page out; this is known as page replacement. If it throws out a
page just before it is about to be used, then it will just have to go get that page again
almost immediately. Too much of this leads to a condition known as thrashing: the
processor spends most of its time swapping pages rather than executing instructions.
The avoidance of thrashing was a major research area in the 1970s and led to a vari-
ety of complex but effective algorithms. In essence, the OS tries to guess, based on
recent history, which pages are least likely to be used in the near future.

A discussion of page replacement algorithms is beyond the scope of this chap-
ter. A potentially effective technique is least recently used (LRU), the same algo-
rithm discussed in Chapter 4 for cache replacement. In practice, LRU is difficult to
implement for a virtual memory paging scheme. Several alternative approaches that
seek to approximate the performance of LRU are in use; see Appendix F for details.

With demand paging, it is not necessary to load an entire process into main
memory. This fact has a remarkable consequence: It is possible for a process to be
larger than all of main memory. One of the most fundamental restrictions in pro-
gramming has been lifted. Without demand paging, a programmer must be acutely
aware of how much memory is available. If the program being written is too large,
the programmer must devise ways to structure the program into pieces that can

be loaded one at a time. With demand paging, that job is left to the OS and the
hardware. As far as the programmer is concerned, he or she is dealing with a huge
memory, the size associated with disk storage.

Because a process executes only in main memory, that memory is referred to
as real memory. But a programmer or user perceives a much larger memory—that
which is allocated on the disk. This latter is therefore referred to as virtual memory.
Virtual memory allows for very effective multiprogramming and relieves the user of
the unnecessarily tight constraints of main memory.

Virtual Memory DEMAND PAGING - The avoidance of thrashing was a major research area in the 1970s and led to a vari- ety of complex but effective algorithms.的更多相关文章

  1. ADDM Reports bug:Significant virtual memory paging was detected on the host operating system

    查看ADDM(数据库版本为ORACLE 10.2.0.5.0)报告时,发现其中有个结论非常不靠谱:Significant virtual memory paging was detected on t ...

  2. Extended paging tables to map guest physical memory addresses from virtual memory page tables to host physical memory addresses in a virtual machine system

    A processor including a virtualization system of the processor with a memory virtualization support ...

  3. Linux Process Virtual Memory

    目录 . 简介 . 进程虚拟地址空间 . 内存映射的原理 . 数据结构 . 对区域的操作 . 地址空间 . 内存映射 . 反向映射 .堆的管理 . 缺页异常的处理 . 用户空间缺页异常的校正 . 内核 ...

  4. Virtual Memory PAGE TABLE STRUCTURE

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION The basic mechanism f ...

  5. vmtouch - the Virtual Memory Toucher

    https://hoytech.com/vmtouch/ [root@localhost ~]# git clone git://github.com/hoytech/vmtouch.git 正克隆到 ...

  6. 阿里云 virtual memory exhausted: 无法分配内存

    在阿里云买了个云服务器,内存1G.编译php时出现下面的错误: virtual memory exhausted: Cannot allocate memory 问题原因:由于物理内存本身很小,且阿里 ...

  7. virtual memory exhausted: Cannot allocate memory 解决方法

    在阿里云买了个云服务器,内存1G.编译kudu时出现下面的错误: virtual memory exhausted: Cannot allocate memory 问题原因:由于物理内存本身很小,且阿 ...

  8. 初识virtual memory

    一.先谈几个重要的东西 virtual memory是一个抽象概念,书上的原文是"an abstraction of main memory known as virtual memory& ...

  9. php编译 :virtual memory exhausted: Cannot allocate memory

    有时候用vps建站时需要通过编译的方式来安装主机控制面板.对于大内存的VPS来说一般问题不大,但是对于小内存,比如512MB内存的VPS来说,很有可能会出现问题,因为编译过程是一个内存消耗较大的动作. ...

随机推荐

  1. VBScript [ 译 ]

    VBScript ( Visual Basic Scripting Edition) 使用COM 来和宿主环境交互.从Microsoft Windows 98 开始的所有的微软桌面操作系统的relea ...

  2. P/Invoke .NET调用win32API

    项目:无线无源测温软件系统 项目中,用到使用P/Invoke在.NET调用win32API,实现对ini配置文件的读写功能!因为有一些配置信息需要保存下来,以便在下一次启动程序完成初始化,这实际上是一 ...

  3. java实例--海盗的最优方案

    package unit4; public class Pirate{ private String name; private int[] schemes; private int index; p ...

  4. WPF/Silverlight Template使用及总结(转)

    WPF/Silverlight 中的控件都有Style和Template两种属性.前者解释为样式,是用来改变控件原有属性的,比如 Button 控件的(Width,Height,Background ...

  5. 找规律/数位DP HDOJ 4722 Good Numbers

    题目传送门 /* 找规律/数位DP:我做的时候差一点做出来了,只是不知道最后的 is_one () http://www.cnblogs.com/crazyapple/p/3315436.html 数 ...

  6. HTML列表-框架

    <frameset frameborder="边框大小" 列cols="各窗口百分比,隔开" 行rows=“各窗口百分比”> <frame n ...

  7. 【wikioi】1012 最大公约数和最小公倍数问题

    题目链接 算法:辗转相除(欧几里得) gcd(a, b)是a和b最小公倍数, lcm(a, b)是a和b的最大公倍数 gcd(a, b) == gcd(b, a%b) 时间复杂度: O(lgb) 具体 ...

  8. sql server 取随机行

    --从table_name中随机取n行 select top n * from table_name order by NEWID()

  9. winform学习之----打开文件对话框并将文件内容放入文本框

    OpenFileDialog ofg = new OpenFileDialog(); ofg.Title = "ddd";//设置对话框标题 ofg.Multiselect = t ...

  10. 【C语言】16-预处理指令2-条件编译

    条件编译的概念 在很多情况下,我们希望程序的其中一部分代码只有在满足一定条件时才进行编译,否则不参与编译(只有参与编译的代码最终才能被执行),这就是条件编译. 一.基本用法 1 #if 条件1 2 . ...