[erlang-questions] New NIF behavior in R15???

Tim Watson <>
Mon Oct 17 15:06:51 CEST 2011


Sounds rather involved, but an interesting example of Erlang providing the
infrastructure glue to various technologies - something that it seems to be
very good at. I've got a couple of linked in drivers I'd like to migrate,
one of which provides an interface to various XSLT processors (Xalan-C,
libxslt, Sablotron, etc) and the other which I recently started, providing a
binding to Oracle via the OCI call interface. It seems to me that both would
benefit from the stability improvements that should come from Native
Processes.

There's one thing I am a little unclear on, and perhaps it's just a case of
RTFM on NIFs. For linked-in drivers, you've got the outputv callback to get
a direct handle to data (in an ErlIOVec) without incurring copying - I guess
that NIFs already minimise the copying which is why they're fast? Also I
make heavy use of the 'driver_send_term' API call, which on the SMP runtime
is safe to use from an arbitrary thread. I'm hoping that this latter
facility (being able to send a message to an arbitrary pid from an arbitrary
worker thread) will be preserved in the new API.

On 17 October 2011 12:43, Matthew Evans <> wrote:

> Right,
>
> In my case I have C code (drivers and an api to some hardware), Java code
> (some app logic and an ipc to a larger java app) and some Erlang doing ipc
> and running a pattern matching app.
>
> What would be nice with the new NIFS is to build the C code as a collection
> of NIF processes, use Jinterface for Java; effectively giving the ability to
> split processing into "applets" all communicating via erlang ipc. The java
> apps could talk to the C code via an erlang message directly, we could then
> move work from java to erlang or visa versa.
>
> I can do this now using NIFS or linked-in drivers and an erlang middleman
> process, but the ability to do it directly is compelling (I.e. Java to a C
> NIF directly using erlang ipc as opposed to Java to Erlang process to C).
>
> Matt
>
> ------------------------------
> Date: Sat, 15 Oct 2011 19:37:44 +0100
>
> Subject: Re: [erlang-questions] New NIF behavior in R15???
> From: 
> To: 
> CC: ; 
>
>
> On 15 October 2011 14:45, Matthew Evans <> wrote:
>
> From what I understand the new NIF features are intended to supercede the
> use of linked in drivers.
>
>
> Right, I apologize for the confusion. This is exactly what I was talking
> about - on slide deck he calls them "Native Processes" - I had forgotten
> that the enhancements were going to sit along side the existing NIF APIs as
> it's been quite some time since I saw the presentation online.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111017/a5e41c2d/attachment.html>


More information about the erlang-questions mailing list