当前位置:网站首页>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 .
边栏推荐
- MySQL的触发器
- Understand chisel language thoroughly 10. Chisel project construction, operation and testing (II) -- Verilog code generation in chisel & chisel development process
- R语言使用dplyr包的group_by函数和summarise函数基于分组变量计算目标变量的均值、标准差
- [matlab] summary of conv, filter, conv2, Filter2 and imfilter convolution functions
- 海外游戏代投需要注意的
- 数据中台概念
- Understand chisel language thoroughly 12. Chisel project construction, operation and testing (IV) -- chisel test of chisel test
- The game goes to sea and operates globally
- ViewModel 初体验
- 【Matlab】conv、filter、conv2、filter2和imfilter卷积函数总结
猜你喜欢
随机推荐
Excel快速合并多行数据
【信息检索】链接分析
Rich text editing: wangeditor tutorial
Incremental ternary subsequence [greedy training]
How to package QT and share exe
商業智能BI財務分析,狹義的財務分析和廣義的財務分析有何不同?
去除重复字母[贪心+单调栈(用数组+len来维持单调序列)]
数据仓库面试问题准备
[R language data science]: cross validation and looking back
富文本编辑:wangEditor使用教程
R语言使用lattice包中的bwplot函数可视化箱图(box plot)、par.settings参数自定义主题模式
Understand chisel language thoroughly 12. Chisel project construction, operation and testing (IV) -- chisel test of chisel test
Abnormal value detection using shap value
MySQL的触发器
C# wpf 实现截屏框实时截屏功能
奇妙秘境 码蹄集
nowcoder重排链表
JVM memory layout detailed, illustrated, well written!
Deming Lee listed on Shenzhen Stock Exchange: the market value is 3.1 billion, which is the husband and wife of Li Hu and Tian Hua
[FAQ] summary of common causes and solutions of Huawei account service error 907135701