lkml.org 
[lkml]   [1999]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux and physical memory


On Sun, 17 Jan 1999, christophe leroy wrote:

> I'm triying to understand the way memory is managed under Linux.
> I cannot understand why we need to "reserve" 0xC0000000-0xFFFFFFFF
> of virtual memory for physical memory.
>
> Why do we need to map entire physical memory to part of virtual
> memory ?

Because the kernel is not a separate process on UNIX. It's a
common part of all processes. When the control is passed to the kernel
(either by system call or by hardware interrupt) no context switch occurs.
Processor simply switches into the privileged mode and jumps into the
kernel code (inaccessible from user mode). This could be done different
for system calls (microkernels), but for interrupts flipping MMU state (VM
map) would lead to delays unacceptable for many sorts of hardware. Kernel
code needs to access *all* physical memory. Linux simply maps it starting
from 0xc000000 (on x86). It's not the only way, see 4.4BSD pmap layer for
example of alternative design. But there is no way in Hell to make all
address space available for process. At the very least, you should have
all kernel code mapped into it (and completely closed for usermode).
Ditto for for large part of kernel data. It's not a Linux-specific
question, BTW - it's how things work in any UNIX kernel.
> We should be able to map part of 4Go physical memory space to
> where we want in virtual memory, by pages of 4kb,
> And each process should be able to have 4Go virtual memory

And where would the kernel live?

> Up to the kernel to do that.

From *where*?

> Dont understand why we cut virtual memory in two parts: one usable
> and one equal to "fixed" 1Go physical memory "pseudo limit"

See above. x86 ain't KL-10. There is only one memory context and switch is
way too expensive. For 64-bit architectures it's mostly non-issue -
physical memory is *much* smaller than the address space.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [from the cache]
©2003-2011 Jasper Spaans