I am trying to set up a shared memory area between an Android Java service and a native process. The native process does not have a Java component, it is purely C ++ and is called from the command line directly using the command line.
I believe that for this I can use an ashtray and a binder. First call ashmem_create_region, call mmap on the result, then pass the resulting fd to another process using a binder. Another process does mmap on fd and thereby accesses the common area.
I understand that this works between two Java applications, and also works between a Java application or service and a process in native mode.
Now I am wondering how a Java service can access data efficiently. I want to use this mechanism to copy a floating point buffer of about 300 MB in size from my own application to a Java service. Now the Java service needs to access this data without overhead, for example, with JNI. What is the best strategy for distributing a common region so that a native program can quickly copy floats to a buffer and a Java service can access values ββwith minimal overhead?
thanks
source share