28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

97<br />

3. Accept that memory remapping support is necessary in a rump kernel <strong>and</strong><br />

h<strong>and</strong>le <strong>the</strong> vnode pager using mmap() <strong>and</strong> munmap().<br />

When comparing <strong>the</strong> first <strong>and</strong> <strong>the</strong> second option, <strong>the</strong> principle used is that memory<br />

I/O is several orders <strong>of</strong> magnitude faster than device I/O. <strong>The</strong>refore, anything which<br />

affects device I/O should be avoided, especially if it might cause extra I/O operations<br />

<strong>and</strong> thus option 1 is preferable over option 2.<br />

To evaluate <strong>the</strong> first option against third option, we simulated pager conditions<br />

<strong>and</strong> measured <strong>the</strong> amount <strong>of</strong> time it takes to construct a contiguous 64kB memory<br />

window out <strong>of</strong> non-contiguous 4kB pages <strong>and</strong> to write <strong>the</strong> window out to a file<br />

backed by a memory file system. <strong>The</strong> result for 1000 loops as a function <strong>of</strong> noncontiguous<br />

pages is presented in Figure 3.9. We conclude that not only is copying<br />

<strong>the</strong> technologically preferred option since it avoids <strong>the</strong> need for memory mapping<br />

support on <strong>the</strong> host, it is also several times faster than mmap()/munmap() pairs.<br />

It should be noted that a fourth option is to implement a separate vnode pager which<br />

does not rely on mapping pages. This option was our initial approach. While <strong>the</strong> effort<br />

produced a superficially working result, we could not get all corner cases to function<br />

exactly <strong>the</strong> same as with <strong>the</strong> regular kernel — for example, <strong>the</strong> VOP_GETPAGES()<br />

interface implemented by <strong>the</strong> vnode pager takes 8 different parameters <strong>and</strong> 14 different<br />

flags. <strong>The</strong> lesson learnt from this attempt with <strong>the</strong> vnode pager reflects our<br />

premise for <strong>the</strong> entire work: it is easy to write superficially working code, but getting<br />

all corner cases right for complicated drivers is extremely difficult.<br />

3.4.2 Memory Allocators<br />

Although memory allocators are not strictly speaking part <strong>of</strong> <strong>the</strong> virtual memory<br />

subsystem, <strong>the</strong>y are related to memory so we describe <strong>the</strong>m here.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!