linux内核内存管理linux内核内存布局①(查看linux操作系统位数|查看linux操作系统软硬件信息)(代码片段)

韩曙亮 韩曙亮     2023-03-09     376

关键词:

文章目录





一、查看 Linux 操作系统位数



64 64 64 位的 Linux 中 ,

  • 使用 48 48 48表示 " 虚拟地址空间 " ;
  • 使用 45 45 45表示 " 物理地址空间 " ;

执行

getconf LONG_BIT

命令 , 可以查看 Linux 操作系统 32 32 32 位还是 64 64 64 位的 ;


得到结果 64 64 64 , 说明该系统是 64 64 64 位 Ubuntu Linux 操作系统 ;





二、查看 Linux 操作系统软硬件信息



执行

cat /proc/cpuinfo

命令 , 可以查看 " Linux 内核位数 “” 系统的软硬件信息 " ;


输出内容解析 :

  • vendor_id : GenuineIntel CPU 制造商 GenuineIntel
  • cpu family : 6 CPU 产品系列代号
  • model : 165 CPU 属于系列中的代号
  • model name : Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz CPU 名称 , 编号 , 主频
  • stepping : 5 CPU 的制作更新版本
  • cpu MHz : 2903.999 CPU 实际使用的主频
  • cache size : 16384 KB CPU 二级缓存大小
  • physical id : 0 单个 CPU 的标号
  • siblings : 1 单个 CPU 逻辑物理核心数量
  • core id : 0 当前 物理核心 在 CPU 中的编号
  • cpu cores : 1 逻辑核心 所在的 物理核心数
  • apicid : 0 区分不同的逻辑核心编号 , 该编号不一定连续 ;
  • bogomips : 5807.99 Linux 内核启动时测量的 CPU 速度
  • clflush size : 64 每次刷新的缓存大小
  • cache_alignment : 64 缓存地址对齐单位
  • address sizes : 42 bits physical, 48 bits virtual 虚拟地址位数 和 物理地址位数

完整输出内容 参考 :

root@ubuntu:~/kernel/linux-5.6.14# getconf LONG_BIT
64
root@ubuntu:~/kernel/linux-5.6.14# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 165
model name	: Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
stepping	: 5
microcode	: 0xc8
cpu MHz		: 2903.999
cache size	: 16384 KB
physical id	: 0
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt arat md_clear flush_l1d arch_capabilities
vmx flags	: vnmi invvpid ept_x_only tsc_offset vtpr mtf ept vpid unrestricted_guest
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit
bogomips	: 5807.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 42 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 165
model name	: Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
stepping	: 5
microcode	: 0xc8
cpu MHz		: 2903.999
cache size	: 16384 KB
physical id	: 2
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt arat md_clear flush_l1d arch_capabilities
vmx flags	: vnmi invvpid ept_x_only tsc_offset vtpr mtf ept vpid unrestricted_guest
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit
bogomips	: 5807.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 42 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 165
model name	: Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
stepping	: 5
microcode	: 0xc8
cpu MHz		: 2903.999
cache size	: 16384 KB
physical id	: 4
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 4
initial apicid	: 4
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt arat md_clear flush_l1d arch_capabilities
vmx flags	: vnmi invvpid ept_x_only tsc_offset vtpr mtf ept vpid unrestricted_guest
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit
bogomips	: 5807.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 42 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 165
model name	: Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
stepping	: 5
microcode	: 0xc8
cpu MHz		: 2903.999
cache size	: 16384 KB
physical id	: 6
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 6
initial apicid	: 6
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt arat md_clear flush_l1d arch_capabilities
vmx flags	: vnmi invvpid ept_x_only tsc_offset vtpr mtf ept vpid unrestricted_guest
bugs		: spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit
bogomips	: 5807.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 42 bits physical, 48 bits virtual
power management:


在虚拟机中的 Ubuntu Linux 打印出的参数是 42 42 42 位物理地址 , 48 48 48 位虚拟地址 ;

address sizes	: 42 bits physical, 48 bits virtual

内存管理:一文读懂linux内存组织结构及页面布局

...ux内存地址空间Linux内存管理全貌2、内存地址——用户态&内核态3、内存地址——MMU地址转换4、内存地址——分段机制1)段选择符更多Linux内核视频教程文档资料免费领取后台私信【内核】自行获取。内核学习网站:Linux内核源码/... 查看详情

linux内核内存管理虚拟地址空间布局架构②(用户虚拟地址空间组成|内存描述符mm_struct结构体源码)(代码片段)

文章目录一、用户虚拟地址空间组成二、内存描述符mm_struct结构体源码一、用户虚拟地址空间组成"用户虚拟地址空间"包括以下区域:①代码段②数据段③未初始化数据段④动态库代码段,数据段,未初始化数据段;⑤堆内存:通... 查看详情

linux内核内存管理虚拟地址空间布局架构⑤(linux内核中对“虚拟地址空间“的描述|task_struct结构体源码)(代码片段)

文章目录一、Linux内核中对"虚拟地址空间"的描述二、task_struct结构体源码一、Linux内核中对"虚拟地址空间"的描述进程的"虚拟地址空间"由mm_struct和vm_area_struct两个数据结构描述;mm_struct是“最高层次"上描述”... 查看详情

linux内核如何管理不到1GB的物理内存?

】linux内核如何管理不到1GB的物理内存?【英文标题】:Howdoesthelinuxkernelmanagelessthan1GBphysicalmemory?【发布时间】:2011-05-3012:55:05【问题描述】:我正在学习linux内核内部结构,在阅读“理解Linux内核”时,我遇到了很多与内存相关... 查看详情

linux内核linux内核体系架构(进程调度|内存管理|中断管理|设备管理|文件系统)

...资源,操作系统,利用进程调度器,令多个进程并发执行;Linux内核没有严格区分进程与线程;进程管理:包括进程创建,销毁,线程组管理,内核线程管理,队列等待;进程调度位于下图Linux内核整体架构图中 查看详情

linux下c程序的内存布局(代码片段)

...,0~3G都是用户空间执行自己代码,高1GB的空间是内核空间执行Linux系统调用的,这里存放在整个内核的代码和所有的内核模块,用户看到和接触到的都是该虚拟地址,并不是实际的物 查看详情

linux内核内存管理物理内存组织结构④(内存区域zone简介|zone结构体源码分析|zone结构体源码)(代码片段)

...333级结构:①内存节点Node,②内存区域Zone,③内存页Page,Linux内核中,使用上述333级结构描述和管理"物理内存";一、内存区域zone简介"内存节点"是内存管理的最顶层结构,"内存节点"再向下划分,就是"内存区域"zon... 查看详情

linux内核 - 如何获取物理地址(内存管理)?

】linux内核-如何获取物理地址(内存管理)?【英文标题】:linuxkernel-howtogetphysicaladdress(memorymanagement)?【发布时间】:2017-04-2616:56:40【问题描述】:在Linux中,页面全局目录偏移地址(cr3+index)可以使用pgd_offset()MACRO计算。PageUppe... 查看详情

linux内核内存管理物理内存组织结构③(内存管理系统三级结构|内存节点描述|内存节点pglist_data结构体|pglist_data结构体源码)(代码片段)

...内存管理系统333级结构:①节点Node,②区域Zone,③页Page,Linux内核中,使用上述333级结构描述和管理"物理内存";一、内存节点描述Linux内核中,内存节点(Node)是"内存管理"的最顶层的结构,下层分别是区域和页;在NUMA非一致内... 查看详情

linux内核内存管理优化内存屏障④(处理器内存屏障|八种处理器内存屏障|通用内存屏障|写内存屏障|读内存屏障|数据依赖屏障|强制性内存屏障|smp内存屏障)

文章目录一、处理器内存屏障二、Linux内核处理器内存屏障一、处理器内存屏障"处理器内存屏障“针对”CPU"之间的内存访问乱序和CPU访问外设乱序问题;为了提高"流水线"性能,新式处理器可以采用"超标量体系结构... 查看详情

linux0.12内核的内存管理基础

在Linux0.12内核中,为了有效地使用机器中的物理内存,在系统初始化阶段内存被划分成几个功能区域。Linux内核程序占据在物理内存的开始部分,接下来是供硬盘或软盘等块设备使用的高速缓冲区部分,其中要扣... 查看详情

了解linux内核如何管理一个进程的内存

Linux进程在内核中是作为进程描述符task_struct(它是在Linux中描述进程完整信息的一种数据结构)的实例来实现的。在task_struct中的mm域指向到内存描述符,mm_struct是一个程序在内存中的执行摘要,如图,它保存... 查看详情

linux内核内存管理linux内核堆内存管理③(cpu计数器瓶颈|per-cpu计数器|linux内核percpu_counter结构体源码)(代码片段)

...响系统性能;二、per-CPU计数器及percpu_counter结构体源码Linux内核中,引入了"per- 查看详情

内核解读之内存管理开篇介绍

...目录1、开篇介绍2、基本概念1、开篇介绍内存管理是linux内核比较重要的一个模块,其实也是任何操作系统里的一个核心专题。在实际的开发工作中,经常会遇到和内存牵扯的问题,比如内存泄露啊,内存越界等。如果你的技术... 查看详情

内核解读之内存管理开篇介绍

...目录1、开篇介绍2、基本概念1、开篇介绍内存管理是linux内核比较重要的一个模块,其实也是任何操作系统里的一个核心专题。在实际的开发工作中,经常会遇到和内存牵扯的问题,比如内存泄露啊,内存越界等。如果你的技术... 查看详情

linux内核内存管理内存管理架构②(用户空间内存管理|malloc|ptmalloc|内核空间内存管理|sys_brk|sys_mmap|sys_munmap)(代码片段)

...、用户空间内存管理(malloc/free/ptmalloc/jemalloc/tcmalloc)二、内核空间内存管理1、内核内存管理系统调用(sys_brk|sys_mmap|sys_munmap)2、sys_brk、sys_mmap系统调用一、用户空间内存管理(malloc/free/ptmalloc/jemalloc/tcmalloc)"应用程序"通过使用C... 查看详情

linux内存相关问题汇总

...和页面布局,内存碎片产生原因和优化算法,linux内核几种内存管理的方法,内存使用场景以及内存使用的那些坑。从内存的原理和结构,到内存的算法优化,再到使用场景,去探寻内存管理的机制和奥秘... 查看详情

启动期间的内存管理之初始化过程概述----linux内存管理

日期内核版本架构作者GitHubCSDN2016-06-14Linux-4.7X86&armgatiemeLinuxDeviceDriversLinux内存管理在内存管理的上下文中,初始化(initialization)可以有多种含义.在许多CPU上,必须显式设置适用于Linux内核的内存模型.例如在x86_32上需要切换到保护... 查看详情