[Xapian-devel] GSoC 2012: Erlang Bindings

Michael Uvarov freeakk at gmail.com
Mon Mar 19 05:47:38 GMT 2012


Thank you for the answers :)
The idea about Erlang is that it has few interfaces with C/C++:
- driver:
    for slow operations, it is a program which waits requests throw stdio.
    It is a safest variant, for example, for image manipulating.
    If the C process crash, Erlang is still alive.
- linked-in driver:
    The same, but a driver is a dll. If it crashed, one Erlang node crashed
    also. But it is faster.
    Use case: RDBMS drivers.
- NIF:
    If we run "module:fun(4)" from Erlang, we will call a C function with
    TERM[1] array as argument. Is is simple, because we don't need encoding and
    decoding data.
    It is faster because it use the same VM thread. Erlang uses the next
    schema: one core of CPU - one thread for a schedule. When we call a NIF,
    it cannot be stopped. It will stop the world, the same behaviour in JVM
    with GC.
    A NIF can provide resources. Resources are objects which can be
automatically
    garbage collecting. Resources must be thread safe, because they
can be shared
    between OS threads.
    Use case: ICU NIFs.



More information about the Xapian-devel mailing list