当前位置:网站首页>Chapter 17 process memory
Chapter 17 process memory
2022-07-04 14:22:00 【yaoxin521123】
List of articles
Chapter 17 Process memory
Introduce
Processes use many different resources to achieve their goals . This includes some or all CPU cycle 、 Memory 、 External storage 、 Network bandwidth, etc . This article is about memory usage . say concretely , It handles the memory allocated for data storage , for example :
- Public and private variables
When assigning values to them for the first time , They are allocated memory space . In the case of local arrays , The combination of local variable name plus all subscript values refers to a single variable value .
Except for variables that contain extremely long strings , Variables will take up with $STORAGE
Related space . Variables containing extremely long strings are stored in different ways , And it doesn't take up $STORAGE
In the space .
- Object instances
Whenever you instantiate an object , Will allocate space to save the current content of the object and the object it refers to . This space is returned when the last object reference is deleted .
- Local
I/O
buffer
Will be associated with the device that the process is using I/O
Buffers are stored in the process space .
Manage process space
The process starts with the initial memory pool for the above entities . When applications create them , They consume memory in the pool ; When the application deletes them , Their memory will be returned to the pool . for example , When a routine starts executing , Always create local variables that consume some memory ; When the routine returns and these variables are out of range , The memory used by these variables will be returned and reused .
When an application needs memory , And the process is not large enough in its memory pool ( continuity ) Available memory area to meet the demand , The process will request additional memory blocks from the underlying operating system to be added to its pool . later , If the memory block is completely unused , It will return to the operating system . Because the order of allocating memory for entities and the order of deleting these entities from memory are not necessarily mirror images of each other , So as the execution goes on , Memory will become fragmented to some extent . This will affect the memory allocation and release of the above operating system .
$ZSTORAGE
Processes can use up to 2TB
Memory . To help manage memory usage , It provides a way for administrators or applications to set small memory consumption limits . This value is stored in the system variable of each process $ZSTORAGE
in , therefore $ZSTORAGE
Always include the maximum allowable size of process memory ( With KB
In units of ).
$ZSTORAGE
The value of 1KB
Specify... For units . The minimum allowable value is 256
, namely 256KB
. The process can be $ZSTORAGE
The maximum value set is 2TB (2^31 * 1KB)
Memory . Trying to set a value less than the minimum value or greater than the maximum value will default to the minimum value or the maximum value, respectively .
Maximum memory per process
This value is set through the management portal . To access relevant pages , Please select system management > To configure > The system configuration > Memory and startup . On the page that appears , Set up Maximum Per-Process Memory (KB)
The value in .
In profile (iris.cpf
) in , This parameter is called bbsiz
. This value is when the process starts $ZSTORAGE
The initial value of the .
Be careful : You can also go through ObjectScript JOB
Set the memory limit of the process when the command starts the process .
$STORAGE
System variables $STORAGE
Indicates the amount of storage available for processes that are still running . It is in bytes . When the memory request of the process is greater than $STORAGE
When the value in or the request to allocate memory from the operating system fails , It will generate <STORE>
error .
error
When the memory request of the process is satisfied, it will lead to $STORAGE
The value of becomes negative , Or when the request of the operating system to allocate memory fails , It will generate <STORE>
error . About handling $STORAGE
Become negative <STORE>
error , A process can be considered to be in one of two modes : Normal mode and low memory mode .
- Normal mode
When the process is in normal mode and requests memory , Otherwise, it will lead to $STORAGE
When it becomes negative , The process throws <STORE>
Error and enter low memory mode .
- Low memory mode
In low memory mode , The allowed operation will $STORAGE
Push to negative , In order to provide some extra memory for the application to handle errors and clean up . When a process in low memory mode releases memory ,$STORAGE
The value of rises to at least 256KB
( or $ZSTORAGE
Of 25%
, If it is lower ), The process will return to normal mode . In low memory mode ,$STORAGE
The lower limit of is about -1MB
. Otherwise, it will lead to $STORAGE
Any operation below this limit will result in <STORE>
error . The value of the lower limit is determined by $STORAGE
Value definition , subtract 1MB
.
Be careful : The process can put $ZSTORAGE
Set to any value within its allowable range . If $ZSTORAGE
Set to less than the currently used value , be $STORAGE
Will have a negative value . If this happens when the process is in normal mode , The next operation to allocate memory will result in the process getting <STORE>
Error and enter low memory mode , The lower limit is equal to this value minus 1MB
. If this happens when the process is already in low memory mode , Then the lower limit remains unchanged .
For reasons beyond -1MB
Low memory mode limit or failure to allocate memory from the operating system <STORE>
error , Because there is too little memory available , The behavior of the process is unpredictable . Into the <STORE>
error , Or the error handler may not be called and the process may stop .
Error handlers can be resolved in one or more of the following ways <STORE>
error :
- Abort the calculation that caused the memory request , It may be possible to release calculations when they occur
<STORE>
Any storage space obtained before the error . - Try to generate more available memory by deleting unwanted data .
- Carry out any necessary cleaning work ( For example, close the open file ), And then terminate the program .
- take
$ZSTORAGE
Set the value of to a larger value , To allow the process to continue and request more memory in the future .
Special notes
platform
Most instances have less allocable space per process than 2TB
Running on the system . On such systems , When The process ran out of available system memory ( Actual physical memory plus available swap space ) when , The underlying system may handle this situation in many ways . Some examples are :
- On some platforms , The system will send a signal , guide Process termination .
- On some platforms ( for example Linux and AIX) On , The system uses heuristic algorithms to kill the process it considers the most aggressive . This may be a process , But it may also be another alternative process .
- Some systems generate kernels that crash the underlying operating system “ panic
panic
” To handle memory exhaustion . - Some systems can handle memory exhaustion , But recovery may lead to access conflicts in the process .
Good programming practice shows that the process should not rely on the error recovery algorithm used by the underlying platform . contrary , Such processes should provide adequate design 、 Testing and logging , To allow the process to properly estimate and manage its own resource needs .
边栏推荐
猜你喜欢
基于51单片机的超声波测距仪
Leetcode T48:旋转图像
Understand chisel language thoroughly 06. Chisel Foundation (III) -- registers and counters
Understand chisel language thoroughly 12. Chisel project construction, operation and testing (IV) -- chisel test of chisel test
统计php程序运行时间及设置PHP最长运行时间
失败率高达80%,企业数字化转型路上有哪些挑战?
2022 practice questions and mock exams for the main principals of hazardous chemical business units
MATLAB中tiledlayout函数使用
C# wpf 实现截屏框实时截屏功能
Unity shader learning (3) try to draw a circle
随机推荐
Data warehouse interview question preparation
2022 game going to sea practical release strategy
ML之shap:基于boston波士顿房价回归预测数据集利用Shap值对LiR线性回归模型实现可解释性案例
Huahao Zhongtian rushes to the scientific and Technological Innovation Board: the annual loss is 280million, and it is proposed to raise 1.5 billion. Beida pharmaceutical is a shareholder
R language uses dplyr package group_ The by function and the summarize function calculate the mean and standard deviation of the target variables based on the grouped variables
Gorm read / write separation (rotation)
【云原生】我怎么会和这个数据库杠上了?
R语言使用dplyr包的mutate函数对指定数据列进行标准化处理(使用mean函数和sd函数)并基于分组变量计算标准化后的目标变量的分组均值
【信息检索】链接分析
Understand chisel language thoroughly 07. Chisel Foundation (IV) - bundle and VEC
奇妙秘境 码蹄集
docker-compose公网部署redis哨兵模式
R语言dplyr包summarise_if函数计算dataframe数据中所有数值数据列的均值和中位数、基于条件进行数据汇总分析(Summarize all Numeric Variables)
nowcoder重排链表
Oppo find N2 product form first exposure: supplement all short boards
Mongodb commonly used 28 query statements (forward)
Code hoof collection of wonderful secret place
【信息检索】分类和聚类的实验
10.(地图数据篇)离线地形数据处理(供Cesium使用)
China Post technology rushes to the scientific innovation board: the annual revenue is 2.058 billion, and the postal group is the major shareholder