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.

92<br />

Hardware interrupt h<strong>and</strong>lers are typically structured to only do a minimal amount<br />

<strong>of</strong> work for acknowledging <strong>the</strong> hardware. <strong>The</strong>y <strong>the</strong>n schedule <strong>the</strong> bulk work to be<br />

done in a s<strong>of</strong>t interrupt (s<strong>of</strong>tint) h<strong>and</strong>ler at a time when <strong>the</strong> OS deems suitable.<br />

As mentioned in Section 2.3.3, we implement hardware interrupts as host threads<br />

which schedule a rump kernel CPU like o<strong>the</strong>r consumers, run <strong>the</strong> h<strong>and</strong>ler, <strong>and</strong> release<br />

<strong>the</strong> CPU. <strong>The</strong> only difference to a regular system is that interrupts are scheduled<br />

instead <strong>of</strong> preempting <strong>the</strong> CPU.<br />

S<strong>of</strong>tints in NetBSD are almost like regular threads. However, <strong>the</strong>y have a number<br />

<strong>of</strong> special properties to keep scheduling <strong>and</strong> running <strong>the</strong>m cheap:<br />

1. S<strong>of</strong>tints are run by level (e.g. networking <strong>and</strong> clock). Only one s<strong>of</strong>tint per<br />

level per CPU may be running, i.e. s<strong>of</strong>tints will run to finish before <strong>the</strong> next<br />

one may be started. Multiple outst<strong>and</strong>ing s<strong>of</strong>tints will be queued until <strong>the</strong><br />

currently running one has finished.<br />

2. S<strong>of</strong>tints may block briefly to acquire a short-term lock, but should not sleep.<br />

This property is a corollary from <strong>the</strong> previous property.<br />

3. S<strong>of</strong>tint h<strong>and</strong>lers must run on <strong>the</strong> same CPU <strong>the</strong>y were scheduled on. This<br />

property relaxes cross-CPU cache effects <strong>and</strong> locking requirements.<br />

4. A s<strong>of</strong>tint may run only after <strong>the</strong> hardware interrupt has completed execution.<br />

That is to say, <strong>the</strong> s<strong>of</strong>tint h<strong>and</strong>ler may not run immediately after it is<br />

scheduled, only when <strong>the</strong> hardware interrupt h<strong>and</strong>ler that scheduled it has<br />

completed execution.<br />

Although in a rump kernel even “hardware” interrupts are essentially s<strong>of</strong>tware interrupts<br />

due to <strong>the</strong>m being scheduled, a fair amount <strong>of</strong> code in NetBSD assumes<br />

that s<strong>of</strong>tints are supported. For example, <strong>the</strong> callout framework [19] schedules s<strong>of</strong>t

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

Saved successfully!

Ooh no, something went wrong!