0

During process execution, when the memory map of a process is like so:

enter image description here

This might be a silly question, but what is responsible for reserving the Kernel space in the address space? Are user processes responsible for this? privileged processes? all processes?

From my understanding, the kernel memory space is reserved by the process running but it is only accessible by the CPU when instructed to execute under ring 0. Is this correct ?

2 Answers 2

1

The kernel takes care of this, on behalf of processes. The kernel’s address space is indeed only accessible when the CPU is in privileged mode, ring 0 on x86.

See also Do the virtual address spaces of all the processes have the same content in their "Kernel" parts?, What's the use of having a kernel part in the virtual memory space of Linux processes?, What's inside the kernel part of virtual memory of 64 bit linux processes?, and When do we jump into kernel part of our process virtual memory other than when we use system calls? (In Linux).

0

This (very simplified) memory map is from times long past, in operating systems far, far away. Today pieces can be mapped at random into the address space (one interesting example is the Linux kernel variable containing current time, for performance of programs requesting it very frequently), and the address space of a program is lots of pieces, scattered all over the (logical) address space. For example, each shared library has it's own swath of memory assigned.

1
  • How is the stack implemented if not ? Do the different libraries allocate their own stack ? Commented Mar 1, 2020 at 22:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.