Evaluating the Java Native Interface (JNI)

Author(s):  
Stelios Sotiriadis ◽  
Oladotun Omosebi ◽  
Assem Ayapbergenova ◽  
Nurbek P. Saparkhojayev

This article describes how the java native interface (JNI) is a powerful feature of the java platform that started to draw attention in the latter years as an efficient programming framework for building and delivering innovative technological applications based on disruptive technologies such as mobile, Internet of Things and embedded systems. Developers use it to incorporate native code written in programming languages such as C, C++, python etc., into java. JNI is particularly useful when java applications need to access existing native libraries or code blocks written in other languages to increase performance, avoid recoding and expand interoperability between programming languages for processes that reside in the same process. This article aims to explore JNI features and to discover fundamental operations of the Java programming language, such as arrays, objects, classes, threads and exception handling, and to illustrate these by using various algorithms and code samples.

Author(s):  
Stelios Sotiriadis ◽  
Oladotun Omosebi ◽  
Assem Ayapbergenova ◽  
Nurbek P. Saparkhojayev

This article aims to explore JNI features and to discover fundamental operations of the Java programming language, such as arrays, objects, classes, threads and exception handling, and to illustrate these by using various algorithms and code samples. The authors also investigate the JNI Invocation API that allows native applications to interact with the Java Virtual Machine (JVM). They focus on attaching native threads to a running JVM and on leveraging existing native code using one-to-one mapping and shared stubs.


2014 ◽  
Vol 25 (4) ◽  
pp. 805-840 ◽  
Author(s):  
GANG TAN

Through foreign function interfaces (FFIs), software components in different programming languages interact with each other in the same address space. Recent years have witnessed a number of systems that analyse FFIs for safety and reliability. However, lack of formal specifications of FFIs hampers progress in this endeavour. We present a formal operational model, Java Native Interface (JNI) light (JNIL), for a subset of a widely used FFI – the Java Native Interface (JNI). JNIL focuses on the core issues when a high-level garbage-collected language interacts with a low-level language. It proposes abstractions for handling a shared heap, cross-language method calls, cross-language exception handling, and garbage collection. JNIL can directly serve as a formal basis for JNI tools and systems. We demonstrate its utility by proving soundness of a system that checks native code in JNI programs for type-unsafe use of JNI functions. The abstractions in JNIL are also useful when modelling other FFIs, such as the Python/C interface and the OCaml/C interface.


2014 ◽  
Vol 11 (1) ◽  
pp. 47-68 ◽  
Author(s):  
Patricia Conde ◽  
Francisco Ortin

Java 7 has included the new invokedynamic opcode in the Java virtual machine. This new instruction allows the user to define method linkage at runtime. Once the link is established, the virtual machine performs its common optimizations, providing better runtime performance than reflection. However, this feature has not been offered at the abstraction level of the Java programming language. Since the functionality of the new opcode is not provided as a library, the existing languages in the Java platform can only use it at the assembly level. For this reason, we have developed the JINDY library that offers invokedynamic to any programming language in the Java platform. JINDY supports three modes of use, establishing a trade-off between runtime performance and flexibility. A runtime performance and memory consumption evaluation is presented. We analyze the efficiency of JINDY compared to reflection, the MethodHandle class in Java 7 and the Dynalink library. The memory and performance costs compared to the invokedynamic opcode are also measured.


2021 ◽  
Vol 2021 ◽  
pp. 1-11
Author(s):  
Jian Zhou ◽  
Xiaotian Gong ◽  
Lijuan Sun ◽  
Yong Xie ◽  
Xiaoyong Yan

Satellite Internet of Things (S-IoT), which integrates satellite networks with IoT, is a new mobile Internet to provide services for social networks. However, affected by the dynamic changes of topology structure and node status, the efficient and secure forwarding of data packets in S-IoT is challenging. In view of the abovementioned problem, this paper proposes an adaptive routing strategy based on improved double Q-learning for S-IoT. First, the whole S-IoT is regarded as a reinforcement learning environment, and satellite nodes and ground nodes in S-IoT are both regarded as intelligent agents. Each node in the S-IoT maintains two Q tables, which are used for selecting the forwarding node and for evaluating the forwarding value, respectively. In addition, the next hop node of data packets is determined depending on the mixed Q value. Second, in order to optimize the Q value, this paper makes improvements on the mixed Q value, the reward value, and the discount factor, respectively, based on the congestion degree, the hop count, and the node status. Finally, we perform extensive simulations to evaluate the performance of this adaptive routing strategy in terms of delivery rate, average delay, and overhead ratio. Evaluation results demonstrate that the proposed strategy can achieve more efficient and secure routing in the highly dynamic environment compared with the state-of-the-art strategies.


Sign in / Sign up

Export Citation Format

Share Document