Skip to content

Methods of Communication

Martin Dráb edited this page Jun 22, 2019 · 1 revision

There are two ways how to send a message to a device:

  • Fast I/O. The method is used usually when the message requires just a little bit of processing from the target driver which does not consume much resources. The kernel does not create any entity representing the message; instead, it just invokes a driver callback routine appropriate for the message type. So, the message can be viewed as a set of input and output parameters of the call. The driver may inform the kernel that it cannot process the message via the fast method. In such a case, the kernel usually sends the message again using the standard method. Supporting the fast method is optional and most drivers need not to bother about it. File system and file system filter drivers are sort of an exception.
  • I/O request packets. The kernel encapsulates the message input (and a place for the output) parameters to an entity called I/O request packet (IRP) and sends it to the target device. Corresponding driver-defined callback routine is invoked to process the request. After the processing is complete, the results and outputs are reported to the originator. The whole message is encoded into one IRP. That means, all driver callback routines responsible for IRP processing may have the same signature (DRIVER_DISPATCH). Unlike the fast IO method, a driver can continue in IRP processing even after the corresponding callback routine returns to the originator which has to wait until the request is marked as complete before its outputs can be examined. So, the standard method is suitable for messages processing of which takes a long time or is difficult in some other way. However, setting up an IRP may impose a non-trivial overhead when the amount of processing by the target driver is small.

When a kernel component wants to communicate with another kernel entity, it can choose the method of communication it likes, providing that the target driver supports it. When an user application attempts to communicate with a device, the kernel attempts to use the fast I/O method and fails back to the standard one if necessary (either because the target driver does not support fast I/O, or because it is not able to use it to process the request).

General

For Users-Developers

Tutorial

Public API

Functions

Types

Clone this wiki locally