
Proceedings Paper
A multi-threaded approach to using asynchronous C libraries with JavaFormat | Member Price | Non-Member Price |
---|---|---|
$17.00 | $21.00 |
Paper Abstract
It is very common to write device drivers and code that access low level operation system functions in C or C+
+. There are also many powerful C and C++ libraries available for a variety of tasks. Java is a programming language
that is meant to be system independent and is arguably much simpler to code than C/C++. However, Java has minimal
support for talking to native libraries, which results in interesting challenges when using C/C++ libraries with Java code.
Part of the problem is that Java's standard mechanism for communicating with C libraries, Java Native Interface,
requires a significant amount of effort to do fairly simple things, such as copy structure data from C to a class in Java.
This is largely solved by using the Java Native Access Library, which provides a reasonable way of transferring data
between C structures and Java classes and calling C functions from Java. A more serious issue is that there is no
mechanism for a C/C++ library loaded by a Java program to call a Java function in the Java program, as this is a major
issue with any library that uses callback functions. A solution to this problem was found using a moderate amount of C
code and multiple threads in Java. The Keck Task Language API (KTL) is used as a primary means of inter-process
communication at Keck and Lick Observatory. KTL is implemented in a series or C libraries and uses callback functions
for asynchronous communication. It is a good demonstration of how to use a C library within a Java program.
Paper Details
Date Published: 18 July 2014
PDF: 11 pages
Proc. SPIE 9152, Software and Cyberinfrastructure for Astronomy III, 91522Y (18 July 2014); doi: 10.1117/12.2055203
Published in SPIE Proceedings Vol. 9152:
Software and Cyberinfrastructure for Astronomy III
Gianluca Chiozzi; Nicole M. Radziwill, Editor(s)
PDF: 11 pages
Proc. SPIE 9152, Software and Cyberinfrastructure for Astronomy III, 91522Y (18 July 2014); doi: 10.1117/12.2055203
Show Author Affiliations
John Gates, Univ. of California Observatories (United States)
William Deich, Univ. of California Observatories (United States)
Published in SPIE Proceedings Vol. 9152:
Software and Cyberinfrastructure for Astronomy III
Gianluca Chiozzi; Nicole M. Radziwill, Editor(s)
© SPIE. Terms of Use
