COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

The simplest scheme for partitioning available memory is to use
fixed-size partitions,
as shown in Figure 8.13. Note that, although the partitions are of fixed size,
they need not be of equal size. When a process is brought into memory, it is placed
in the smallest available partition that will hold it.
 
Even with the use of unequal fixed-size partitions, there will be wasted memory.
In most cases, a process will not require exactly as much memory as provided by
the

partition. For example, a process that requires 3M bytes of memory would be placed
in the 4M partition of Figure 8.13b, wasting 1M that could be used by another process.
 
A more efficient approach is to use variable-size partitions. When a process is
brought into memory, it is allocated exactly as much memory as it requires and no more.
 
 
Example 8.2
An example, using 64 Mbytes of main memory, is shown in Figure 8.14.
Initially, main memory is empty, except for the OS (a). The first three processes are loaded
in, starting where the OS ends and occupying just enough space for each process (b, c, d).
This leaves a “hole” at the end of memory that is too small for a fourth process. At some
point, none of the processes in memory is ready. The OS swaps out process 2 (e), which
leaves sufficient room to load a new process, process 4 (f). Because process 4 is smaller
than process 2, another small hole is created. Later, a point is reached at which none of the
processes in main memory is ready, but process 2, in the Ready-Suspend state, is available.
Because there is insufficient room in memory for process 2, the OS swaps process 1 out (g)
and swaps process 2 back in (h).
 
 
 
As this example shows, this method starts out well, but eventually it leads to a
situation in which there are a lot of small holes in memory. As time goes on, mem-
ory becomes more and more fragmented, and memory utilization declines. One
technique for overcoming this problem is
compaction
: From time to time, the OS
shifts the processes in memory to place all the free memory together in one block.
This is a time-consuming procedure, wasteful of processor time.
 
Before we consider ways of dealing with the shortcomings of partitioning, we
must clear up one loose end. Consider Figure 8.14; it should be obvious that a proc-
ess is not likely to be loaded into the same place in main memory each time it is
swapped in. Furthermore, if compaction is used, a process may be shifted while in
main memory. A process in memory consists of instructions plus data. The instruc-
tions will contain addresses for memory locations of two types:
Addresses of data items
Addresses of instructions, used for branching instruction
 
But these addresses are not fixed. They will change each time a process is
swapped in. To solve this problem, a distinction is made between logical addresses
and physical addresses. A logical address is expressed as a location relative to the
beginning of the program. Instructions in the program contain only logical addresses.
A physical address is an actual location in main memory. When the processor exe-
cutes a process, it automatically converts from logical to physical address by adding
the current starting location of the process, called its base address, to each logical
address. This is another example of a processor hardware feature designed to meet
an OS requirement. The exact nature of this hardware feature depends on the mem-
ory management strategy in use. We will see several examples later in this chapter.

Partitioning的更多相关文章

  1. [LeetCode] Palindrome Partitioning II 拆分回文串之二

    Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...

  2. [LeetCode] Palindrome Partitioning 拆分回文串

    Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...

  3. Leetcode: Palindrome Partitioning II

    参考:http://www.cppblog.com/wicbnu/archive/2013/03/18/198565.html 我太喜欢用dfs和回溯法了,但是这些暴力的方法加上剪枝之后复杂度依然是很 ...

  4. 測試大型資料表的 Horizontal Partitioning 水平切割

    FileGroup 檔案群組 :一個「資料庫(database)」可對應一或多個 FileGroup,一個 FileGroup 可由一或多個 file (.ndf) 構成. FileGroup 可讓 ...

  5. UVA - 11584 Partitioning by Palindromes[序列DP]

    UVA - 11584 Partitioning by Palindromes We say a sequence of char- acters is a palindrome if it is t ...

  6. LintCode Palindrome Partitioning II

    Given a string s, cut s into some substrings such that every substring is a palindrome. Return the m ...

  7. How to Remove Table Partitioning in SQL Server

    In this article we will see how we can remove partitions from a table in a database in SQL server. I ...

  8. Partitioning & Archiving tables in SQL Server (Part 2: Split, Merge and Switch partitions)

    Reference: http://blogs.msdn.com/b/felixmar/archive/2011/08/29/partitioning-amp-archiving-tables-in- ...

  9. Partitioning & Archiving tables in SQL Server (Part 1: The basics)

    Reference: http://blogs.msdn.com/b/felixmar/archive/2011/02/14/partitioning-amp-archiving-tables-in- ...

  10. LeetCode(131)Palindrome Partitioning

    题目 Given a string s, partition s such that every substring of the partition is a palindrome. Return ...

随机推荐

  1. XML引入多scheme文件约束简单示例

    XML引入多scheme文件约束简单示例,用company.xsd和department.xsd来约束company.xml: company.xsd <?xml version="1 ...

  2. 把Chrome浏览器变成文本编辑器

    CoderWall 分享的一个小技巧. 在浏览器地址栏中输入一行代码:data:text/html, <html contenteditable> ,回车即可把浏览器变临时编辑器. 按f1 ...

  3. C# PropertyGrid控件应用心得

    何处使用 PropertyGrid 控件 在应用程序中的很多地方,您都可以使用户与 PropertyGrid 进行交互,从而获得更丰富的编辑体验.例如,某个应用程序包含多个用户可以设置的“设置”或选项 ...

  4. compareTo,Comparator和equals

    compareTo和equal 在Java中我们常使用Comparable接口来实现排序,其中compareTo是实现该接口方法.我们知道compareTo返回0表示两个对象相等,返回正数表示大于,返 ...

  5. 递推DP POJ 1163 The Triangle

    题目传送门 题意:找一条从顶部到底部的一条路径,往左下或右下走,使得经过的数字和最大. 分析:递推的经典题目,自底向上递推.当状态保存在a[n][j]时可省去dp数组,空间可优化. 代码1: /*** ...

  6. ps怎么把白色背景变透明

  7. storm源码之理解Storm中Worker、Executor、Task关系 + 并发度详解

    本文导读: 1 Worker.Executor.task详解 2 配置拓扑的并发度 3 拓扑示例 4 动态配置拓扑并发度 Worker.Executor.Task详解: Storm在集群上运行一个To ...

  8. TYVJ P1013 找啊找啊找GF Label:动态规划

    做题记录:2016-08-15 22:19:04 背景 MM七夕模拟赛 描述 "找啊找啊找GF,找到一个好GF,吃顿饭啊拉拉手,你是我的好GF.再见.""诶,别再见啊.. ...

  9. 原来还有这样的记词方法_Java版记不规则动词_博主推荐

    昨天在看一本英语书的不规则动词的时候,突然产生的灵感:就是想把这样记单词简单方式,用程序代码实现,然后,使用户可以与之进行交互 这样,在用户背不规则动词的时候就会轻松把它给记住.基于这一点,于是我就思 ...

  10. pygame系列_原创百度随心听音乐播放器_完整版

    程序名:PyMusic 解释:pygame+music 之前发布了自己写的小程序:百度随心听音乐播放器的一些效果图 你可以去到这里再次看看效果: pygame系列_百度随心听_完美的UI设计 这个程序 ...