Linux进程内存方案 [英] Linux process memory scheme

查看:91
本文介绍了Linux进程内存方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AFAIK有一个进程存储器的分区,用于存储与内核相关的数据,并将其标记为只读.

AFAIK there's a partition of a process memory that stores kernel related data and it's marked as read-only.

我找不到事实解释,为什么会发生这种情况,该区域的目的是什么,为什么要在每个进程存储空间中都包含它?

I can't find a factual explanation for why this happens, what is the purpose of this area and why should you include it in every process memory space ?

推荐答案

就像用户模式的存储空间一样,内核需要自己的代码段(RX),数据段(R/RW)和堆栈帧.线程(RW).

Just like the user-mode memory space, the kernel needs its own code section (RX), data section (R/RW), and stack frames for the threads (RW).

我不会说它需要包含在进程内存空间中,而是说它是内核始终驻留的地方.与进程之间每次进行上下文切换时都会被替换的进程内存空间不同,内核空间(32位> = 0xC0000000和64位>> = 0xFFFFFFFF80000000)整体上永远不会被替换.

I would not say that it needs to be included in process memory space, but rather say that it's where the kernel always resides. Unlike the process memory space that gets replaced whenever there's a context switch between processes, the kernel space (>=0xC0000000 in 32bit and >=0xFFFFFFFF80000000 in 64bit), in its entirety, never gets replaced.

这是一个必要的要求,因为系统上只有一个内核,并且必须始终将其保留在内存中的同一位置(虚拟),以处理系统调用,中断和运行各种内核任务.

This is a necessary requirement since there's only one kernel on a system and it must remain at the same place in the memory (virtual) at all times for handling system calls, interrupts, and running various kernel tasks.

这篇关于Linux进程内存方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆