当前位置:首页 > 服务端 > Partitioning

Partitioning

COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

 

Partitioning _ JavaClub全栈架构师技术笔记

 

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).
 
 
Partitioning _ JavaClub全栈架构师技术笔记
 
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.

作者:papering
来源链接:https://www.cnblogs.com/rsapaper/p/6216600.html

版权声明:
1、Java侠(https://www.javaxia.com)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaxia.com/server/125379.html

标签: out of memory
分享给朋友:

“Partitioning” 的相关文章

[C#]richtextbox实现拖放2022年05月17日 20:25:47
Spring Boot+微信小程序2022年05月20日 21:27:40
Python 散列表查询2022年05月20日 21:28:09
Hugo LoveIt主题配置与使用2022年05月23日 21:56:27
OpenHarmony的多内核2022年05月30日 23:18:14
关于picgo中阿里云图床的设置2022年05月31日 20:01:14