为什么说内核在进程地址空间中? [英] Why is kernel said to be in process address space?

查看:68
本文介绍了为什么说内核在进程地址空间中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但在我脑海中却突然冒出.有关进程地址空间和虚拟内存布局的所有文字都提到进程地址空间具有 为内核保留的空间.例如在32位系统上,进程地址空间为4GB,其中1 GB为Linux中的内核保留(其他OS上可能有所不同).

This might be a silly question but it just popped up in my mind. All the text about process address space and virtual memory layout mentions that the process address space has space reserved for kernel. For e.g. on 32 bit systems the process address space is 4GB of which 1 GB is reserved for kernel in Linux (Might be different on other OS).

我只是想知道为什么当进程无法直接寻址内核时,为什么说内核位于进程地址空间中.为什么我们不说内核与进程相比有一个单独的地址空间,为什么我们不能为内核本身有一个与进程的页面表分开的页表呢?

I am just wondering why kernel is said to be in the process address space when a process cannot address the kernel directly. Why don't we say that the kernel has a separate address space than a process and why can't we have a different page table for kernel itself which is separate from the page tables of the processes?

推荐答案

当进程进行系统调用时,我们不需要为以下目的切换页表(从进程地址空间页表到内核地址空间页表)服务系统调用(仅应在内核模式下完成).据说这是内核在进程上下文中运行.

When the process makes a system call, we don't need to switch the page tables (from process address space page table to kernel address space page table) for servicing the system call (which should be done only in kernel mode). This is said to be that the kernel is running in the process context.

某些不会在进程上下文中运行的内核事件将仅为内核加载页表.

Some kernel events which won't run in process context will load the page tables only for kernel.

知道了吗?

这篇关于为什么说内核在进程地址空间中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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