next up previous contents index
Next: 9.1 Managing the Address Up: understand-html Previous: 8.7 Interfacing with the   Contents   Index


9. Process Address Space

The allocation methods discussed till now have dealt exclusively with kernel requests. They are considered high priority, rarely deferred9.1 and never swapped out. It is presumed that the kernel is error free and has a good reason for needing the memory. More importantly, the kernel addressing space does not change so no matter what process is running, the virtual address space reserved for the kernel remains the same.

It is very different for processes. Each process has its own linear address space which potentially can change with every context switch. The only exception is when lazy TLB switch is in use which processes such as init use.

Allocations on behalf of a user process are considered low priority and are not satisfied immediately. Instead space is reserved in the linear address space and a physical page is only allocated upon access which is signaled by a page fault.

The process address is not trusted or presumed to be constant. The kernel is prepared to catch all exception and addressing errors raised from userspace. When the kernel is copying to or from userspace, the functions copy_to_user() and copy_from_user() are used to read memory rather than accessing the addresses directly. Linux relies on the MMU to raise exceptions when the address is bad and have the Page Fault Exception handler catch and fix it up. In the x86 case, assembler is provided by the __copy_user() to trap exceptions where the address is totally useless. The location of the fixup code is found when the function search_exception_table() is called.



Footnotes

... deferred9.1
vmalloc being the exception which is only allocated on page fault


Subsections
next up previous contents index
Next: 9.1 Managing the Address Up: understand-html Previous: 8.7 Interfacing with the   Contents   Index
Mel 2003-01-14