0

I've known that we have Kernel space and User space in a Linux system. User space is used by some specific program, and it can communicate with Kernel space with some way, for example, system call.

I've also known that a program uses the memory with the rule: Memory layout, we have Stack, Heap, Text, BSS, Data etc.

Now I have a question: what is the relation between Memory layout and Kernel/User space? Must Memory layout be in the User space? Or are the two notions irrelevant?

Yves
  • 3,291

1 Answers1

1

The two notions are orthogonal. When referring to memory, user space is the memory accessible when running with user-level privileges, kernel space that accessible when running with kernel-level privileges. The memory layout is how that memory is used, and that’s up to each “user”.

The kernel has its own memory layout, extensively documented on 64-bit x86.

Stephen Kitt
  • 434,908