One reason for giving programmers control over their memory map is to allow two or more
processes to share the same memory. If programmers can name regions of their memory, it may be
possible for one process to give another process the name of a memory region so that process can
also map it in. With two (or more) processes sharing the same pages, high bandwidth sharing
becomes possible: one process writes into the shared memory and another one reads from it.
Sharing of pages can also be used to implement a high-performance message passing system.
Normally, when messages are passed, the data are copied from one address space to another, at
considerable cost. If processes can control their page map, a message can be passed by having the
sending process unmap the page(s) containing the message, and the receiving process mapping them
in. Here only the page names have to be copied, instead of all the data.
Yet another advanced memory management technique is distributed shared memory (Feeley et al.,
1995; Li and Hudak, 1989; and Zekauskas et al., 1994). The idea here is to allow multiple processes
over a network to share a set of pages, possibly, but not necessarily, as a single shared linear address
space. When a process references a page that is not currently mapped in, it gets a page fault. The
page fault handler, which may be in the kernel or in user space, then locates the machine holding the
page and sends it a message asking it to unmap the page and send it over the network. When the
page arrives, it is mapped in and the faulting instruction is restarted.
The GFP_KERNEL parameter is an example of a gfp_mask flag. It is discussed shortly.
Make note of the error checking after the call to __get_free_pages().A kernel allocation
can fail, and your code must check for and handle such errors.
This might mean
unwinding everything you have done thus far. It therefore often makes sense to allocate
your memory at the start of the routine to make handling the error easier.
vmalloc() is used
only when absolutely necessary—typically, to obtain large regions of memory. For example,
when modules are dynamically inserted into the kernel, they are loaded into memory
created via vmalloc().
Linux prefers paging to
segmentation for the following reasons:
Is sharing of procedures between users facilitated?
No Yes
Why was this technique invented?
paging is To get a large linear address space without having to buy more physical memory
segmenting is To allow programs and data to be broken up into logically independent address spaces and to aid sharing and protection
RAM
There are special nonvolatile RAMs that integrate a battery-backup system,
such that the RAM remains powered even when the rest of the computer system has shut down.
processes to share the same memory. If programmers can name regions of their memory, it may be
possible for one process to give another process the name of a memory region so that process can
also map it in. With two (or more) processes sharing the same pages, high bandwidth sharing
becomes possible: one process writes into the shared memory and another one reads from it.
Sharing of pages can also be used to implement a high-performance message passing system.
Normally, when messages are passed, the data are copied from one address space to another, at
considerable cost. If processes can control their page map, a message can be passed by having the
sending process unmap the page(s) containing the message, and the receiving process mapping them
in. Here only the page names have to be copied, instead of all the data.
Yet another advanced memory management technique is distributed shared memory (Feeley et al.,
1995; Li and Hudak, 1989; and Zekauskas et al., 1994). The idea here is to allow multiple processes
over a network to share a set of pages, possibly, but not necessarily, as a single shared linear address
space. When a process references a page that is not currently mapped in, it gets a page fault. The
page fault handler, which may be in the kernel or in user space, then locates the machine holding the
page and sends it a message asking it to unmap the page and send it over the network. When the
page arrives, it is mapped in and the faulting instruction is restarted.
The GFP_KERNEL parameter is an example of a gfp_mask flag. It is discussed shortly.
Make note of the error checking after the call to __get_free_pages().A kernel allocation
can fail, and your code must check for and handle such errors.
This might mean
unwinding everything you have done thus far. It therefore often makes sense to allocate
your memory at the start of the routine to make handling the error easier.
vmalloc() is used
only when absolutely necessary—typically, to obtain large regions of memory. For example,
when modules are dynamically inserted into the kernel, they are loaded into memory
created via vmalloc().
Linux prefers paging to
segmentation for the following reasons:
Is sharing of procedures between users facilitated?
No Yes
Why was this technique invented?
paging is To get a large linear address space without having to buy more physical memory
segmenting is To allow programs and data to be broken up into logically independent address spaces and to aid sharing and protection
RAM
There are special nonvolatile RAMs that integrate a battery-backup system,
such that the RAM remains powered even when the rest of the computer system has shut down.