next up previous contents
Next: Mapped Network Interface Up: Restricted Access to Network Interface Previous: Handler at User Level

Handler in Kernel

 

We now examine the same example under the assumption that the handler can be executed while in kernel mode. Figure 2.3 shows the timing diagram.

  figure123
Figure 2.3: Restricted Access to the Network Interface, Handler in the Kernel: An arriving message interrupts the currently running user application. The kernel, in supervisor mode, receives the message and deposits it into a buffer. Immediately thereafter, the handler starts running. To send messages, the handler simply calls the appropriate kernel function. A return from interrupt resumes execution of the user application.

As before, the currently running user application is interrupted when a message arrives. The node switches context at a cost of tex2html_wrap_inline1851 and enters kernel mode. It takes tex2html_wrap_inline1853 time to receive the message into main memory. Now, however, executing the handler is a simple and cheap function call. The handler performs the same operations as before. When it sends a message, it simply calls the appropriate function in the kernel.

This method saves the time of a context switch to the handler, a trap into the kernel to restore the originally running process, and the two traps and returns to send the messages:
displaymath1887
We will see in Section 2.2 that safely executing a user defined handler in the kernel costs additional time. It is the goal of this work to establish how much overhead is imposed by the various techniques to execute handlers in kernel mode and compare that to tex2html_wrap_inline1895 and other benefits of this approach.

The saving of two traps and returns, tex2html_wrap_inline1897, is specific to our example. For handlers that require more traps into the kernel, the time savings would further increase. For handlers with fewer kernel requests, the time savings could decrease to as little as
displaymath1888
Most handlers require at least one system call to send a reply.


next up previous contents
Next: Mapped Network Interface Up: Restricted Access to Network Interface Previous: Handler at User Level

Rolf Riesen
Wed Jan 22 22:24:20 MST 1997