next up previous
Next: Dependent buffers. Up: Rationale on Dispatchers and Previous: Flow dispatchers.

Flow handles.

A flow handle is a special kind of dispatcher that is associated with two queues: a queue of free buffers and a queue of already received packets. A flow handle, which is implemented as a trusted system class, checks in its dispatch routine whether the queue of free buffers is empty. An empty free queue means that the buffer space for this flow is exhausted. The flow handle was not supplied with enough memory and no further action is taken. Otherwise, a buffer is dequeued and ``exchanged'' with the system buffer that is presented to the dispatch routine. The buffer containing the data is then enqueued in the handle's received queue. In this way, a receiving flow is directly charged for the incoming packet when it is demultiplexed.

Flow handles must be supplied with preallocated buffer space upfront. For this purpose, they provide methods to allocate buffers which are charged to the caller's budget, or to recycle buffers handed to them by a caller.

Flow handles are also used to ``receive'' a packet, just as one would use sockets to receive a packet. Receiving a packet simply involves dequeuing a packet from the handle's receive queue. As usual, receivers that are blocked on an empty receive queue are awoken when a packet is enqueued.

Dispatching packets might involve traversing internal data structures; for instance, an ANTS node will try to look up the method associated with an incoming packet in its code cache. To avoid duplicating this work once the packet is ready to be processed, the dispatcher may set buffer-specific data at dispatch time which can be read at packet processing time.



Jay Lepreau
Tue Jun 2 05:48:49 MDT 1998