当前位置:网站首页>Top performance version 2 reading notes (IV) -- memory monitoring
Top performance version 2 reading notes (IV) -- memory monitoring
2022-06-30 00:29:00 【jrglinux】
《System Performance: Enterprise and the Cloud, 2nd Edition (2020)》 Reading notes and brief notes
7. Memory memory
7.1 The term
| The term | chinese | |
|---|---|---|
| main memory | Main memory | Physical memory |
| virtual memory | Virtual memory | Abstract main memory concept , Virtual memory is not real memory |
| resident memory | memory-resident | Memory currently in main memory |
| anonymous memory | Anonymous memory | Memory without file system location or pathname . Including the working data of the process address space , It's called a heap |
| address space | address space | Memory context |
| segment | paragraph | An area of memory marked for special use , For example, it is used to store executable or writable pages |
| instruction text | Instruction text | In memory cpu Instructions , Usually in segments |
| OOM | OOM | out of memory |
| page | page | Operating system and CPU The unit of memory used .4KB or 8KB, Modern processing supports multiple page sizes to support larger page sizes |
| page fault | Page missing | Invalid memory access |
| paging | Change the page | Exchange pages between main memory and storage devices |
| swapping | In exchange for | It refers to transferring the whole process from the main memory to the switching device .Linux Medium exchange refers to the transfer of pages to the exchange device ( Migration Exchange page ) |
| swap | In exchange for ( Space ) | Disk space for storing anonymous data of page change and exchange process . It can be a piece of space for a storage device , Also known as a physical switching device , Or file system , Called swap file . |
7.2 Concept
Basic concepts related to memory and memory performance .
7.2.1 Virtual memory virtualmemory
The process address space is mapped by the virtual memory subsystem to main memory and the physical swap device.
swap Partitions are often called swap partitions , This is a special hard disk space , That is, when the actual memory is not enough , The operating system will take out some temporarily unused data from memory , In the swap partition , So as to make enough memory space for the currently running program .
7.2.2 Change the page paging
Page change is to change pages into and out of main memory , They are called page in and page out respectively . allow :
- Run a partially loaded program
- Run programs larger than main memory
- Efficient migration between main memory and storage devices
Two kinds of :file system paging 、 anonymous paging.
| paging | ||
|---|---|---|
| file system paging | File system page change | File system paging is caused by the reading and writing of pages in memory-mapped files. File system paging is triggered by reading and writing mapped file pages located in memory . If a file system page has been modified in main memory (dirty), Page out page-out You need to change this page write todisk; contrary , If it hasn't been modified (clean), Because the disk already has a copy , therefore page-out You can just free up this memory for reuse . |
| anonymous paging | Change pages anonymously | Anonymous paging involves data that is private to processes: the process heap and stacks. Anonymous page feed involves process private data : Heap and stack . Why is it called anonymous page change ? Because in OS It lacks a named address ( If there is no file system path ). Anonymous page feed requires that data be migrated to physical exchange devices or exchange files ,linux In exchange for (swap) To order this type of page change . Anonymous page feed affects performance , When app When accessing the paged out page , Will be read I/O Operation blocking , This is the process of anonymous page changing , to app Bring synchronization delay . Switching out anonymous page feeds does not directly affect performance , Because it is executed asynchronously by the kernel |
7.2.3 Page change on demand demanding paging

7.2.4 Over submission overcommit
Linux The system allows excessive submission , Allow allocation of more than the system can store ---- More than the sum of physical memory and switched devices .
With overcommit,malloc() You will be successful , Otherwise failure , Developers can allocate memory generously and use it sparsely on demand , Instead of taking care to distribute .
7.2.5 In exchange for process swaping
Process swapping is the movement of entire processes between main memory and the physical swap device or swap file.
Move the entire process between main memory and the physical exchange device or exchange file .
7.2.6 File system cache usage file system cache usage
Process swapping is the movement of entire processes between main memory and the physical swap device or swap file
7.2.7 Utilization and saturation utilization and saturation
Main memory utilization can be calculated as used memory versus total memory.
The memory occupied by the file cache can be treated as unused , Because it can be reused by applications .
When the demand for memory exceeds the main memory, it is called main memory saturation , Now OS Can use page feed 、 Exchange or in Linux Use in OOM To free up memory .
7.2.8 distributor allocators
When virtual memory handles multitasking physical memory , The actual allocation of virtual address space and memory stacking are usually handled by allocators .API Interface is malloc(),free() And so on .
7.2.9 Shared memory shared memory
Whether the shared memory between processes should be counted into the total memory occupied by a process ?proportional set size (PPS) Solve the problem , Contains private memory ( Unshared ) Separate from shared memory .pmap Tools .
7.2.10 Working set size work set size
7.2.11 The word is long word size
7.3 framework
7.3.1 Hardware
Main memory
Time delay
Time available to access main memory CAS Time delay (column address strobe, Column address controller ) To measure : Send the address to be read from ( Column ) Give a memory module , Time until data can be read .
Main memory architecture
UMA

Above picture , Through the shared bus , Every CPU Access memory has uniform access delay . If a single operating system instance is running above and can run uniformly on all processors , Also called symmetric multiprocessor architecture (SMP).
NUMA
CPU1 It can be directly connected to... Through its memory bus DRAM A launch I/O operation , This is called local memory .CPU1 adopt CPU2 as well as CPU interconnection ( Two hop ) Yes DRAM B launch I/O operation , This is due to higher remote memory access latency .
Bus
| Shared bus | shared system bus | Such as UMA |
| Direct connection | direct | processor Direct connection memory |
| interconnection | interconnect | multiprocessor in , Every processor Directly connected to the respective memory , The processors are connected by a CPU Interconnection connection , Such as NUMA |
DDR SDRAM
For any architecture , The speed of the memory bus often depends on the memory interface standards supported by the processor and the motherboard .
1996 Year of double data rate synchronous dynamic random-access memory(DDR SDRAM)( Double rate synchronous dynamic random access memory ).
Multichannel multichannel
Multiple memory buses in parallel , Increase the speed . There are usually two channels (dual-), Three channels (triple-), Four channels (quad-). such as inter-i7 The processor is a four channel DDR3-1600, The maximum memory bandwidth is 51.2Gbytes/s.
CPU cache
L1/L2/L3 cache .
MMU Memory management unit
Manage address mapping from virtual memory to physical memory .
边栏推荐
- How to write controller layer code gracefully?
- MySQL advanced 1
- 利用 CertBot 申请 Let’s Encrypt SSL 证书
- GET 和 POST请求的本质区别是什么?
- Preliminary syntax of JS
- Flask web minimalist tutorial (III) - Sqlalchemy (part a)
- Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘
- Which securities company is better and which platform is safer for stock speculation account opening
- 【UML】UML的几种关系(依赖-关联-聚合-组合-继承-实现)
- 简要的说一下:Fragment 间的通信方式?
猜你喜欢

Sofaregistry source code | data synchronization module analysis

Automatic integration: yescomusa, an overseas cross-border e-commerce, cooperates with cloud expansion to realize one-stop Automation Service

微信支付 APP端 第三弹 申请退款

Project 1: deploy lamp ECSHOP e-commerce platform
![[advanced C language] user defined type](/img/0d/50924ef21f07ca8188855c2b78d929.png)
[advanced C language] user defined type
![[dynamic programming] - linear DP](/img/cb/4ad8dce1da1d1110d6e79fadca4293.png)
[dynamic programming] - linear DP

What is the essential difference between get and post requests?
![[advanced C language] address book implementation](/img/e6/8a51d519d31ec323cf04c59a556325.png)
[advanced C language] address book implementation

俞敏洪:我的退与进;架构师必须了解的5种最佳软件架构模式;Redis夺命52连问|码农周刊VIP会员专属邮件周报 Vol.096

How to seamlessly transition from traditional microservice framework to service grid ASM
随机推荐
Flask web minimalist tutorial (III) - Sqlalchemy (part a)
请指教在线开户是什么意思?另外想问,现在在线开户安全么?
js中的事件
Sword finger offer II 035 Minimum time difference
Vulnhub target -moriartycorp
Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘
[advanced C language] address book implementation
Sword finger offer II 037 Asteroid collision
How to write controller layer code gracefully?
Is there any discount for securities account opening? Is it safe to open an account online?
[daily question 1] traversal of binary tree
MySQL basics 1
SSH key disclosure (module B competition topic) -- Application Service Vulnerability scanning and utilization
TP5查询AND和OR条件嵌套
SQL Server database addition, deletion, modification and query statements
【UML】UML的几种关系(依赖-关联-聚合-组合-继承-实现)
[programming problem] maze problem
蛇形矩阵(数组模拟方向, d代表转弯)
VIM plug in manager VIM plug installation method
Sofaregistry source code | data synchronization module analysis