NX is the message passing system used on the Intel Paragon and its predecessors [73, ]. The hrecv() function behaves much like an ordinary receive with the exception that, upon message arrival, a user specified handler is invoked. The mechanism is interrupt driven and a full context switch to the handler occurs on message reception.
To measure performance, we used a simple benchmark that posts an
hrecv() and then waits for a global variable to change. The
handler that is invoked by hrecv() increments this variable
and returns. (This is a measurement of
.) Averaged
over 10000 trials, we measured an invocation time of about
s. The same measurement for an irecv(), a non-blocking
receive without a handler, yields
s. Figure 3.1
shows the pseudo code of our benchmark.

Figure 3.1: hrecv() Benchmark: Measure the time from
message arrival until start of the handler
(
).
In both cases the receive is pre-posted and the receiving node spins in a tight loop at user level, waiting for the incoming message. The incoming message causes an interrupt and the operating system kernel reads the zero length message from the network.
To process an hrecv(), the kernel switches context to the
handler, executes it, and does another context switch to the
original user program. The handler sets the global variable
gotit to TRUE. Inside the loop, the test program checks the global
variable to determine when the handler has run. While the test
program spins inside the loop, it produces a series of time stamps.
Once outside the loop, it is easy to determine the time stamp from
just before the interrupt took place. The gap to the next time
stamp is larger (
) than the gaps measured in
successive, uninterrupted loop iterations. The constant
is larger than the overhead of a clock() function call, but
less than the interrupt time: (clock()
-
clock()
)
In the case of an irecv(), the kernel simply returns to the user level. Inside the loop, the test program uses msgdone() to know when the message has arrived. Again, a larger gap between time stamps reveals the one just before and the one just after the interrupt has been taken. The high cost of hrecv() makes it impractical to use in the contexts proposed for this research.